MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / insertTestArticle

Function insertTestArticle

server/tests/integration/addie-learning.test.ts:96–127  ·  view source on GitHub ↗
(options: {
      title: string;
      daysAgo?: number;
      qualityScore?: number;
      tags?: string[];
      topic?: string;
    })

Source from the content-addressed store, hash-verified

94 });
95
96 async function insertTestArticle(options: {
97 title: string;
98 daysAgo?: number;
99 qualityScore?: number;
100 tags?: string[];
101 topic?: string;
102 }) {
103 const fetchedAt = new Date();
104 if (options.daysAgo) {
105 fetchedAt.setDate(fetchedAt.getDate() - options.daysAgo);
106 }
107
108 await pool.query(
109 `INSERT INTO addie_knowledge (
110 title, category, content, source_url, source_type, fetch_status,
111 last_fetched_at, quality_score, relevance_tags, summary, is_active
112 ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)`,
113 [
114 `${TEST_NEWS_PREFIX}${options.title}`,
115 'news',
116 options.topic ? `Content about ${options.topic}` : 'Test article content',
117 `https://example.com/${options.title.toLowerCase().replace(/\s+/g, '-')}`,
118 'rss',
119 'success',
120 fetchedAt,
121 options.qualityScore ?? 4,
122 options.tags ?? [],
123 `Summary of ${options.title}`,
124 true,
125 ]
126 );
127 }
128
129 describe('getRecentNews', () => {
130 it('should return recent articles sorted by date', async () => {

Callers 1

Calls 1

queryMethod · 0.80

Tested by

no test coverage detected