fix: [verified] separate Target lifecycle channels and export typography
Build and publish Eldorado documentation / build (pull_request) Successful in 50s
Build and publish Eldorado documentation / build (pull_request) Successful in 50s
This commit is contained in:
1 parent
7e3696d2d7
commit
0248baa97b
6 files changed
+199
-20
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import {test} from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {targetRouting, targetLifecycleOffsets} from './target-routing.mjs';
|
||||
|
||||
const fixture = targetLifecycleOffsets.map(({id, from, to, x, y1, y2}) => `<g data-graph-role="automatic-crossover" style="--step:9">
|
||||
<path data-graph-role="automatic-crossover-underlay" d="M ${x} ${y1} L ${x} ${y2}"/>
|
||||
<path data-edge-from="${from}" data-edge-to="${to}" data-edge-id="${id}" data-composition-points="${x},${y1};${x},${y2}" d="M ${x} ${y1} L ${x} ${y2}" marker-end="url(#arrowhead-emphasis)"/>
|
||||
</g>`).join('\n');
|
||||
|
||||
test('Target adapter shifts precisely four paths, masks and composition points', () => {
|
||||
const unrelated = '<path data-edge-id="govern-architecture" d="M 600 450 L 870 262.5"/><g data-node-id="agent"/>';
|
||||
const output = targetRouting(fixture + unrelated);
|
||||
assert(output.endsWith(unrelated));
|
||||
let restored = output;
|
||||
for (const {x, shiftedX, y1, y2} of targetLifecycleOffsets) {
|
||||
assert.equal(output.split(`d="M ${shiftedX} ${y1} L ${shiftedX} ${y2}"`).length, 3);
|
||||
assert(output.includes(`data-composition-points="${shiftedX},${y1};${shiftedX},${y2}"`));
|
||||
restored = restored.replaceAll(`d="M ${shiftedX} ${y1} L ${shiftedX} ${y2}"`, `d="M ${x} ${y1} L ${x} ${y2}"`)
|
||||
.replace(`data-composition-points="${shiftedX},${y1};${shiftedX},${y2}"`, `data-composition-points="${x},${y1};${x},${y2}"`);
|
||||
}
|
||||
assert.equal(restored, fixture + unrelated, 'all other bytes preserved');
|
||||
});
|
||||
|
||||
test('Target adapter fails closed on missing, duplicate, moved or changed native edges', () => {
|
||||
for (const changed of [fixture.replace('stage-2', 'missing'), fixture + fixture,
|
||||
fixture.replace('870 262.5', '871 262.5'), fixture.replace('870,262.5', '871,262.5'),
|
||||
fixture.replace('data-edge-from="architecture"', 'data-edge-from="scope"'),
|
||||
fixture.replace('automatic-crossover-underlay', 'unknown')]) {
|
||||
assert.throws(() => targetRouting(changed), /Target routing drift/);
|
||||
}
|
||||
assert.throws(() => targetRouting(targetRouting(fixture)), /Target routing drift/);
|
||||
});
|
||||
Reference in new issue
Block a user