Files
brain/tools/m6-snapshot.test.mjs
T

16 lines
874 B
JavaScript

import { describe, it, expect } from 'vitest';
import { snapshotNeeded } from './snapshot-decide.mjs';
import { snapshotDecision } from './enforce-snapshot.mjs';
describe('M6 snapshot — интеграция', () => {
it('escaped reset --hard → снимок делается до выполнения', () => {
const writes = [];
const r = snapshotDecision({ tool_name: 'Bash', tool_input: { command: 'git reset --hard' }, session_id: 's' },
{ gitImpl: () => ({ stashOut: 'sha', headOut: 'h', error: false }), writeImpl: (x) => writes.push(x), idImpl: () => 'i', now: 1 });
expect(r.block).toBe(false); expect(writes.length).toBe(1);
});
it('snapshotNeeded только на Bash-floor', () => {
expect(snapshotNeeded('Bash', { command: 'rm -rf x' })).toBe(true);
expect(snapshotNeeded('Write', { file_path: 'a' })).toBe(false);
});
});