From 01512081db0d41cb86c921a61961275c8c18aedb Mon Sep 17 00:00:00 2001 From: Sergey Matyunin Date: Mon, 24 Aug 2026 17:02:48 +0300 Subject: [PATCH] test: enforce shared near-axis threshold source Issue: #290 User-Visible: no --- test/near-axis.test.mjs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/near-axis.test.mjs b/test/near-axis.test.mjs index 70ed203c..8bbdee6e 100644 --- a/test/near-axis.test.mjs +++ b/test/near-axis.test.mjs @@ -17,6 +17,21 @@ const fixture = JSON.parse(readFileSync( new URL('./fixtures/279-near-orthogonal-junction.json', import.meta.url), 'utf8', )); const clone = (value) => JSON.parse(JSON.stringify(value)); +const sourceOf = (file) => readFileSync(new URL(`../src/${file}`, import.meta.url), 'utf8'); + +test('#290 authoring, Optimize and renderer use one near-axis threshold source', () => { + const renderer = sourceOf('wall-thickness.ts'); + const authoring = sourceOf('houseplan-card.ts'); + const optimizer = sourceOf('plan-optimizer.ts'); + + assert.match(renderer, /import \{ NEAR_AXIS_MAX_DEGREES \} from '\.\/near-axis';/); + assert.match(renderer, + /export const MULTI_WALL_NEAR_ORTHOGONAL_MAX_DEGREES = NEAR_AXIS_MAX_DEGREES;/); + assert.match(authoring, /import \{ snapNearAxisEndpoint \} from '\.\/near-axis';/); + assert.match(authoring, /snapNearAxisEndpoint\(/); + assert.match(optimizer, /import \{ repairNearAxisRoomWalls \} from '\.\/near-axis';/); + assert.match(optimizer, /repairNearAxisRoomWalls\(space\)/); +}); test('#290 near-axis boundary is shared, inclusive and bounded', () => { assert.equal(NEAR_AXIS_MAX_DEGREES, 0.25);