feat(round-memory): version-diff + round-memory-store (SP2a)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Дмитрий
2026-06-16 15:31:31 +03:00
parent e6347b2a70
commit 51654894c8
4 changed files with 177 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import { describe, it, expect } from 'vitest';
import { diffLines } from './version-diff.mjs';
describe('diffLines', () => {
it('добавленные строки помечает +', () => {
const d = diffLines('a\nb', 'a\nb\nc');
expect(d).toContain('+ c');
});
it('удалённые строки помечает -', () => {
const d = diffLines('a\nb\nc', 'a\nc');
expect(d).toContain('- b');
});
it('идентичные тексты → пустой diff', () => {
expect(diffLines('a\nb', 'a\nb').trim()).toBe('');
});
it('пустой/нестроковый вход не кидает', () => {
expect(() => diffLines('', '')).not.toThrow();
expect(() => diffLines(null, undefined)).not.toThrow();
});
});