bb7633b318
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
17 lines
964 B
JavaScript
17 lines
964 B
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { upsertIndexEntry } from './secretary-index.mjs';
|
|
|
|
describe('upsertIndexEntry', () => {
|
|
it('добавляет новое дело', () => {
|
|
const md = upsertIndexEntry('', { slug: 'sec', title: 'Секретарь', goal: 'память сути', status: 'открыто', date: '2026-06-21' });
|
|
expect(md).toContain('[Секретарь](sec/protocol.md)');
|
|
expect(md).toContain('открыто');
|
|
});
|
|
it('обновляет существующее дело без дубля', () => {
|
|
const first = upsertIndexEntry('', { slug: 'sec', title: 'Секретарь', goal: 'g', status: 'открыто', date: '2026-06-21' });
|
|
const upd = upsertIndexEntry(first, { slug: 'sec', title: 'Секретарь', goal: 'g', status: 'закрыто', date: '2026-06-22' });
|
|
expect(upd.match(/sec\/protocol\.md/g).length).toBe(1);
|
|
expect(upd).toContain('закрыто');
|
|
});
|
|
});
|