import { describe, it, expect } from 'vitest'; import { verifyEncoding, renderIndexContext } from './secretary-hookutil.mjs'; describe('verifyEncoding', () => { it('пустое — не ок', () => { expect(verifyEncoding('').ok).toBe(false); }); it('BOM — не ок', () => { expect(verifyEncoding('текст').ok).toBe(false); }); it('нормальный UTF-8 — ок', () => { expect(verifyEncoding('текст').ok).toBe(true); }); }); describe('renderIndexContext', () => { it('оборачивает оглавление', () => { const out = renderIndexContext('- [X](x/protocol.md) — цель · открыто · 2026-06-22'); expect(out).toContain('Открытые дела'); expect(out).toContain('x/protocol.md'); }); it('пустое — помечает отсутствие', () => { expect(renderIndexContext('')).toContain('дел пока нет'); }); });