9ac6d96dee
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
1.5 KiB
JavaScript
27 lines
1.5 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 { appendRoundObjection, readRoundObjections } from './round-memory-store.mjs';
|
|
|
|
describe('round-memory-store', () => {
|
|
it('append судья → read дословно по порядку', () => {
|
|
const dir = mkdtempSync(join(tmpdir(), 'rms-'));
|
|
try {
|
|
appendRoundObjection({ taskId: 't1', side: 'judge', objectionVerbatim: 'круг1: нет X', fsImpl: fs, dir });
|
|
appendRoundObjection({ taskId: 't1', side: 'judge', objectionVerbatim: 'круг2: нет Y', fsImpl: fs, dir });
|
|
expect(readRoundObjections({ taskId: 't1', side: 'judge', fsImpl: fs, dir })).toEqual(['круг1: нет X', 'круг2: нет Y']);
|
|
} finally { rmSync(dir, { recursive: true, force: true }); }
|
|
});
|
|
it('side фильтруется; пустая не пишется', () => {
|
|
const dir = mkdtempSync(join(tmpdir(), 'rms-'));
|
|
try {
|
|
appendRoundObjection({ taskId: 't2', side: 'judge', objectionVerbatim: 'j', fsImpl: fs, dir });
|
|
appendRoundObjection({ taskId: 't2', side: 'mentor', objectionVerbatim: 'm', fsImpl: fs, dir });
|
|
expect(appendRoundObjection({ taskId: 't2', side: 'judge', objectionVerbatim: '', fsImpl: fs, dir })).toBe(false);
|
|
expect(readRoundObjections({ taskId: 't2', side: 'judge', fsImpl: fs, dir })).toEqual(['j']);
|
|
} finally { rmSync(dir, { recursive: true, force: true }); }
|
|
});
|
|
});
|