mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
test: make lattice and Optimize smokes CI-clean
Issue: #291 User-Visible: no
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
// #291: the production bundle's ordinary config and point-wise layout writers
|
||||
// must adopt and send the same exact lattice candidate without editor-specific
|
||||
// snap calls.
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { launch, checkAll, finish } from './serve.mjs';
|
||||
import { latticeProfile } from '../scripts/model-invariants.mjs';
|
||||
|
||||
// `model-invariants.mjs` intentionally imports compiled production geometry.
|
||||
// A standalone smoke must therefore create the same test-build that `npm test`
|
||||
// creates; relying on a developer's leftover directory made clean Linux CI
|
||||
// fail before the browser scenario even started.
|
||||
const root = fileURLToPath(new URL('..', import.meta.url));
|
||||
execFileSync(process.execPath, [
|
||||
resolve(root, 'node_modules/typescript/bin/tsc'), '-p', 'tsconfig.test.json',
|
||||
], { cwd: root, stdio: 'inherit' });
|
||||
execFileSync(process.execPath, [resolve(root, 'scripts/fix-test-build.mjs')], {
|
||||
cwd: root, stdio: 'inherit',
|
||||
});
|
||||
const { latticeProfile } = await import('../scripts/model-invariants.mjs');
|
||||
|
||||
const { page, browser } = await launch({ width: 920, height: 840 });
|
||||
const out = await page.evaluate(async () => {
|
||||
|
||||
@@ -19,7 +19,8 @@ const out = await page.evaluate(async () => {
|
||||
return `${q((a[0] + b[0]) / 2).toFixed(6)},${q((a[1] + b[1]) / 2).toFixed(6)}@${bucket.toFixed(4)}`;
|
||||
};
|
||||
const entry = (a, b, cm) => ({ key: wallKey(a, b), a, b, cm });
|
||||
const y = 0.345833333, split = 0.8875, microEnd = split + 0.001381904;
|
||||
const y = 0.345833333, canonicalY = 83 / 240;
|
||||
const split = 0.8875, microEnd = split + 0.001381904;
|
||||
const original = {
|
||||
model_version: 7,
|
||||
spaces: [{
|
||||
@@ -87,15 +88,15 @@ const out = await page.evaluate(async () => {
|
||||
const appliedWalls = card._serverCfg.spaces[0].walls;
|
||||
result.applyUsesOneAtomicWrite = sent.filter((type) => type === 'houseplan/plan/optimize').length === 1;
|
||||
result.applyStoresOneUniformRun = appliedWalls.length === 1 && appliedWalls[0].cm === 22
|
||||
&& JSON.stringify(appliedWalls[0].a) === JSON.stringify([0.8, y])
|
||||
&& JSON.stringify(appliedWalls[0].b) === JSON.stringify([0.95, y]);
|
||||
&& JSON.stringify(appliedWalls[0].a) === JSON.stringify([0.8, canonicalY])
|
||||
&& JSON.stringify(appliedWalls[0].b) === JSON.stringify([0.95, canonicalY]);
|
||||
result.applyEnablesUndo = card._canOptimizeUndo === true;
|
||||
|
||||
await card._loadFromServer(); await card.updateComplete;
|
||||
const reloadedWalls = card._serverCfg.spaces[0].walls;
|
||||
result.reloadKeepsCanonicalRun = reloadedWalls.length === 1 && reloadedWalls[0].cm === 22
|
||||
&& JSON.stringify(reloadedWalls[0].a) === JSON.stringify([0.8, y])
|
||||
&& JSON.stringify(reloadedWalls[0].b) === JSON.stringify([0.95, y]);
|
||||
&& JSON.stringify(reloadedWalls[0].a) === JSON.stringify([0.8, canonicalY])
|
||||
&& JSON.stringify(reloadedWalls[0].b) === JSON.stringify([0.95, canonicalY]);
|
||||
|
||||
await card._undoPlanOptimization(); await card.updateComplete;
|
||||
result.undoUsesServerSnapshot = sent.filter((type) => type === 'houseplan/plan/optimize_undo').length === 1;
|
||||
|
||||
Reference in New Issue
Block a user