✨ feature: Enhance output options with Google Sheets integration and improve Excel writer functionality
This commit is contained in:
@@ -41,4 +41,49 @@ describe('run orchestration', () => {
|
||||
expect(result.linksExtracted).toBe(1);
|
||||
expect(writes).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('only sends locally marked sponsored links to the sponsored output', async () => {
|
||||
const stateFile = join(dir, 'state.json');
|
||||
const writes: any[] = [];
|
||||
|
||||
await runCatalog({
|
||||
config: {
|
||||
gmail: { folder: 'Newsletters' },
|
||||
output: { name: 'Catalog', excel: { enabled: true, path: join(dir, 'out.xlsx') } },
|
||||
stateFile
|
||||
},
|
||||
messages: [
|
||||
{
|
||||
id: 'msg-1',
|
||||
messageId: '<msg-1>',
|
||||
from: 'Web Tools Weekly <w@example.com>',
|
||||
date: '2026-05-16T00:00:00.000Z',
|
||||
html: `
|
||||
<div>
|
||||
<a href="https://cascade.example">Cascade</a> - CSS property icons.
|
||||
<a href="https://frames.example">Fancy Frames</a> - Decorative borders.
|
||||
SPONSORED
|
||||
<a href="https://flexboxle.example">flexboxle</a> - A daily puzzle game.
|
||||
<a href="https://types.example">Typescale AI</a> - A typescale generator.
|
||||
</div>
|
||||
`
|
||||
}
|
||||
],
|
||||
writers: [{ write: async (payload) => writes.push(payload) }]
|
||||
});
|
||||
|
||||
expect(writes[0].sponsors).toEqual([
|
||||
{
|
||||
Newsletter: 'Web Tools Weekly',
|
||||
Sponsor: 'flexboxle',
|
||||
Link: 'https://flexboxle.example/',
|
||||
Description: 'A daily puzzle game.'
|
||||
}
|
||||
]);
|
||||
expect(writes[0].rows.map((row: any) => row.Title)).toEqual([
|
||||
'Cascade',
|
||||
'Fancy Frames',
|
||||
'Typescale AI'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user