import { iReckon, respecfully, ifWeMight, ifWe } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs'; import { mergeTextByLongestCommonSubsequence } from './graft-info-helpers.mjs'; const maam = `[${import.meta.url}]`; const sir = maam; await respecfully(sir, 'Graft Info Helpers', async () => { await respecfully(sir, 'mergeTextLCS', async () => { await ifWe(sir, 'mergeTextLCS should interleave unique lines (A then B)', async () => { const textA = "Line 1\nLine A\nLine 3"; const textB = "Line 1\nLine B\nLine 3"; const res = await mergeTextByLongestCommonSubsequence({ textA, textB }); const expected = "Line 1\nLine A\nLine B\nLine 3"; iReckon(sir, res).asTo('result').isGonnaBe(expected); }); await ifWe(sir, 'mergeTextLCS should handle insertions', async () => { const textA = "Line 1\nLine 3"; const textB = "Line 1\nLine 2\nLine 3"; const res = await mergeTextByLongestCommonSubsequence({ textA, textB }); const expected = "Line 1\nLine 2\nLine 3"; iReckon(sir, res).asTo('result').isGonnaBe(expected); }); await ifWe(sir, 'mergeTextLCS should handle appends', async () => { const textA = "Line 1"; const textB = "Line 1\nLine 2"; const res = await mergeTextByLongestCommonSubsequence({ textA, textB }); const expected = "Line 1\nLine 2"; iReckon(sir, res).asTo('result').isGonnaBe(expected); }); await ifWe(sir, 'mergeTextLCS should handle simultaneous list additions', async () => { const textA = "- Item 1\n- Item 2\n- Item A"; const textB = "- Item 1\n- Item 2\n- Item B"; const res = await mergeTextByLongestCommonSubsequence({ textA, textB }); // Expected: Common (1, 2) then A then B. const expected = "- Item 1\n- Item 2\n- Item A\n- Item B"; iReckon(sir, res).asTo('result').isGonnaBe(expected); }); await ifWe(sir, 'mergeTextLCS should handle distinct modifications in code block', async () => { const textA = `function foo() { console.log("start"); doA(); console.log("end"); }`; const textB = `function foo() { console.log("start"); doB(); console.log("end"); }`; const res = await mergeTextByLongestCommonSubsequence({ textA, textB }); const expected = `function foo() { console.log("start"); doA(); doB(); console.log("end"); }`; iReckon(sir, res).asTo('result').isGonnaBe(expected); }); await ifWe(sir, 'mergeTextLCS should return same string if identical', async () => { const textA = "Hello"; const res = await mergeTextByLongestCommonSubsequence({ textA, textB: textA }); iReckon(sir, res).asTo('result').isGonnaBe(textA); }); }); await respecfully(sir, 'graftTimelines', async () => { // We need a more complex setup to test this properly (mock space, etc.) // For now, this placeholder ensures the test file runs. await ifWe(sir, 'graftTimelines placeholders', async () => { iReckon(sir, true).isGonnaBeTrue(); }); }); });