9ac6d96dee
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
1.4 KiB
JavaScript
27 lines
1.4 KiB
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { mkdtempSync, rmSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import { join } from 'node:path';
|
|
import fs from 'node:fs';
|
|
import { appendVerdictOutcome, readUnsurfaced, markAllSurfaced } from './verdict-surface-store.mjs';
|
|
|
|
describe('verdict-surface-store', () => {
|
|
it('append → read непоказанные → mark → пусто', () => {
|
|
const dir = mkdtempSync(join(tmpdir(), 'vss-'));
|
|
try {
|
|
expect(appendVerdictOutcome({ sessionId: 's1', line: '✅ GO — опечатано', fsImpl: fs, dir })).toBe(true);
|
|
expect(appendVerdictOutcome({ sessionId: 's1', line: '🚫 NO-GO: X', fsImpl: fs, dir })).toBe(true);
|
|
expect(readUnsurfaced({ sessionId: 's1', fsImpl: fs, dir })).toEqual(['✅ GO — опечатано', '🚫 NO-GO: X']);
|
|
markAllSurfaced({ sessionId: 's1', fsImpl: fs, dir });
|
|
expect(readUnsurfaced({ sessionId: 's1', fsImpl: fs, dir })).toEqual([]);
|
|
} finally { rmSync(dir, { recursive: true, force: true }); }
|
|
});
|
|
it('пустая строка не пишется', () => {
|
|
const dir = mkdtempSync(join(tmpdir(), 'vss-'));
|
|
try {
|
|
expect(appendVerdictOutcome({ sessionId: 's2', line: '', fsImpl: fs, dir })).toBe(false);
|
|
expect(readUnsurfaced({ sessionId: 's2', fsImpl: fs, dir })).toEqual([]);
|
|
} finally { rmSync(dir, { recursive: true, force: true }); }
|
|
});
|
|
});
|