import { mkdtemp, rm } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { runCatalog } from '../src/run/runCatalog.js'; let dir = ''; beforeEach(async () => { dir = await mkdtemp(join(tmpdir(), 'nlc-run-')); }); afterEach(async () => { await rm(dir, { force: true, recursive: true }); }); describe('run orchestration', () => { it('does not write output or state during dry run', async () => { const stateFile = join(dir, 'state.json'); const writes: unknown[] = []; const result = await runCatalog({ dryRun: 1, skipEnrich: true, config: { gmail: { folder: 'Newsletters' }, output: { name: 'Catalog', excel: { enabled: true, path: join(dir, 'out.xlsx') } }, stateFile }, messages: [ { id: 'msg-1', messageId: '', from: 'A ', date: '2026-05-16T00:00:00.000Z', html: '

Python

Article

' } ], writers: [{ write: async (payload) => writes.push(payload) }] }); expect(result.linksExtracted).toBe(1); expect(writes).toHaveLength(0); }); });