28 lines
811 B
TypeScript
28 lines
811 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { validateDateFilters } from '../src/cli/flags.js';
|
|
import { loadConfigFromString } from '../src/config/config.js';
|
|
|
|
describe('config validation', () => {
|
|
it('loads a valid YAML config with defaults', () => {
|
|
const config = loadConfigFromString(`
|
|
gmail:
|
|
folder: Newsletters
|
|
output:
|
|
name: Newsletter Link Catalog
|
|
excel:
|
|
enabled: true
|
|
path: ./output/catalog.xlsx
|
|
`);
|
|
|
|
expect(config.gmail.folder).toBe('Newsletters');
|
|
expect(config.links.trackingParams).toContain('utm_*');
|
|
expect(config.enrichment.concurrency).toBe(3);
|
|
});
|
|
|
|
it('rejects conflicting relative and absolute date filters', () => {
|
|
expect(() => validateDateFilters({ last: '30d', from: '2026-01-01' })).toThrow(
|
|
/cannot be combined/i
|
|
);
|
|
});
|
|
});
|