Skip to content

Commit 2546460

Browse files
committed
feat(tests): add tests for highlights section and source generation in article content
1 parent cbea897 commit 2546460

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

tests/data-transformers.test.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,48 @@ describe('Data Transformers', () => {
273273
}, 'motions', 'en');
274274
expect(content).toContain('Test Motion');
275275
});
276+
277+
it('should include highlights section when highlights are provided', () => {
278+
const content = generateArticleContent(
279+
{
280+
events: mockEvents,
281+
highlights: [
282+
{ title: 'Budget Vote', description: 'Critical budget debate expected' },
283+
{ title: 'EU Summit', description: 'Key EU decisions ahead' }
284+
]
285+
},
286+
'week-ahead',
287+
'en'
288+
);
289+
expect(content).toContain('What to Watch');
290+
expect(content).toContain('Budget Vote');
291+
expect(content).toContain('Critical budget debate expected');
292+
expect(content).toContain('EU Summit');
293+
});
294+
295+
it('should include Swedish highlights section', () => {
296+
const content = generateArticleContent(
297+
{
298+
events: mockEvents,
299+
highlights: [
300+
{ title: 'Budgetomröstning', description: 'Viktig budgetdebatt förväntas' }
301+
]
302+
},
303+
'week-ahead',
304+
'sv'
305+
);
306+
expect(content).toContain('Vad man ska följa');
307+
expect(content).toContain('Budgetomröstning');
308+
});
309+
310+
it('should handle events with no date field', () => {
311+
const content = generateArticleContent(
312+
{ events: [{ title: 'No date event' }], highlights: [] },
313+
'week-ahead',
314+
'en'
315+
);
316+
expect(typeof content).toBe('string');
317+
});
276318
});
277319

278320
describe('generateSources', () => {
@@ -297,5 +339,19 @@ describe('Data Transformers', () => {
297339

298340
expect(sources.some(s => s.includes('Calendar') || s.includes('Riksdagen'))).toBe(true);
299341
});
342+
343+
it('should include sources for all MCP tool types', () => {
344+
const sources = generateSources([
345+
'get_calendar_events', 'get_betankanden', 'get_propositioner',
346+
'get_motioner', 'search_dokument'
347+
]);
348+
349+
expect(sources).toContain('riksdag-regering-mcp');
350+
expect(sources).toContain('Riksdagen Calendar');
351+
expect(sources).toContain('Committee Reports');
352+
expect(sources).toContain('Government Propositions');
353+
expect(sources).toContain('Parliamentary Motions');
354+
expect(sources).toContain('Riksdagen Documents');
355+
});
300356
});
301357
});

0 commit comments

Comments
 (0)