mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
Save Stage 2 structure, text, geometry and layout generation, independent oracle checks, frontend seeded replay and plugin visible-value checks. Include pending grid sync and deletion fixes with focused regressions. WIP validation: component sync 21 tests / 106 assertions; move shapes 6 tests / 33 assertions. Earlier plugin checks passed 68 full cases, 11 unit tests and types. The final generated replay, golden check, 5000-case gate, full suites and live WASM check remain unfinished. Stages 3 (swaps/variants) and 4 (library files) have not started. F124 benchmark ratios against Phase 1e: main 10/100/1000 copies 0.48/0.52/0.54; three levels 0.53; chain 0.56; library 0.52; many shapes 0.42; variant switch 0.64. No regression flag. The F125 deletion change still needs its final benchmark. Save the detailed resume checklist and logs in the local stabilization plan. Keep that workflow document out of the commit. AI-assisted-by: GPT-6
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { strict as assert } from "node:assert";
|
|
import { test } from "node:test";
|
|
import { makeProgram } from "../src/composable-tests/random/program.ts";
|
|
import { PenpotSync } from "../src/composable-tests/util/PenpotSync.ts";
|
|
|
|
test("random programs replay a seed exactly", () => {
|
|
assert.deepEqual(makeProgram(712, 40), makeProgram(712, 40));
|
|
assert.notDeepEqual(makeProgram(712, 40), makeProgram(713, 40));
|
|
assert.equal(makeProgram(712, 40).length, 40);
|
|
assert.equal(makeProgram(0, 0).length, 0);
|
|
});
|
|
|
|
test("propagation fails when pending work never settles", async () => {
|
|
const scope = globalThis as unknown as { penpot: unknown };
|
|
const previous = scope.penpot;
|
|
scope.penpot = { waitForLayoutUpdate: () => new Promise(() => {}) };
|
|
try {
|
|
await assert.rejects(PenpotSync.awaitPropagation(5), /did not settle/);
|
|
} finally {
|
|
scope.penpot = previous;
|
|
}
|
|
});
|
|
|
|
test("propagation waits for the completion promise", async () => {
|
|
const scope = globalThis as unknown as { penpot: unknown };
|
|
const previous = scope.penpot;
|
|
let complete!: () => void;
|
|
scope.penpot = { waitForLayoutUpdate: () => new Promise<void>((resolve) => (complete = resolve)) };
|
|
try {
|
|
let settled = false;
|
|
const waiting = PenpotSync.awaitPropagation(1000).then(() => (settled = true));
|
|
await Promise.resolve();
|
|
assert.equal(settled, false);
|
|
complete();
|
|
await waiting;
|
|
assert.equal(settled, true);
|
|
} finally {
|
|
scope.penpot = previous;
|
|
}
|
|
});
|