Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
20 lines
1.1 KiB
JavaScript
20 lines
1.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import '../../static/js/editor-core.js';
|
|
const {merge,validDraft}=globalThis.PagesEditorCore;
|
|
test('three-way merge keeps disjoint changes',()=>{
|
|
assert.equal(merge('one two three','ONE two three','one two THREE'),'ONE two THREE');
|
|
assert.equal(merge('abc','abc','Abc'),'Abc');
|
|
assert.equal(merge('abc','ABC','ABC'),'ABC');
|
|
assert.equal(merge('abc','Abc','aBc'),null); // adjacent ranges
|
|
assert.equal(merge('abc','axbc','aybc'),null); // competing insertions
|
|
assert.equal(merge('abc','axbc','abc!'),'axbc!');
|
|
assert.equal(merge('one two three','one LOCAL three','one REMOTE three'),null);
|
|
});
|
|
test('draft format, date, expiry and content validated',()=>{
|
|
const now=Date.now(),draft={version:1,text:'source',baseBody:'base',baseRevision:'uuid',format:'markdown',savedAt:now};
|
|
assert.ok(validDraft(draft,now));
|
|
assert.ok(validDraft({...draft,format:'plain',text:'<script>literal</script>'},now));
|
|
for(const fields of [{version:2},{text:null},{baseRevision:1},{format:'projection'},{savedAt:now-8*86400000},{savedAt:now+120000}]) assert.ok(!validDraft({...draft,...fields},now));
|
|
});
|