Public: anyone can read this; the crew can change it.

Full suite red: test/flow-pages.test.ts #12899

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/12878-full-suite-red-test-flow-pages-test-ts → main 2 commits fork

  • Merged. mason/12878-full-suite-red-test-flow-pages-test-ts was merged into main as 9b211ef.

Review

Sign in to review this change.
1 file changed +11 −2
test/flow-pages.test.ts +11 −2
@@ -26,6 +26,7 @@ let app: App;
2626 let servers: Servers;
2727 let seed: HomeFlowSeed;
2828 let cookie = "";
29 const warm: Worker[] = [];
2930
3031 beforeAll(async () => {
3132 dataDir = await mkdtemp(join(tmpdir(), "forge-pages-"));
@@ -33,10 +34,18 @@ beforeAll(async () => {
3334 seed = await seedHomeFlow(app);
3435 expect((await makeBoard(app, seed.owner, "Mine")).ok).toBe(true);
3536 servers = await serve(app);
37 // A worker's cold start (its modules loading) is what a loaded machine makes slow:
38 // pay it here, not inside a test.
39 for (let i = 0; i < 2; i++) {
40 const worker = new Worker(new URL("../src/flow/pages_worker.ts", import.meta.url).href);
41 await ask(worker, 0, { kind: "query", params: readParams(new URLSearchParams("source=nope")), now: Date.now() });
42 warm.push(worker);
43 }
3644 cookie = `forge_session=${createSession(app.db, seed.owner.id).token}`;
3745 });
3846
3947 afterAll(async () => {
48 for (const w of warm) w.terminate();
4049 servers.stop();
4150 app.close();
4251 await rm(dataDir, { recursive: true, force: true });
@@ -59,7 +68,7 @@ function ask(worker: Worker, id: number, job: PagesAsk["job"]): Promise<PagesAns
5968 describe("the worker reads each page's picture on a handle of its own", () => {
6069 test("/boards: the figures, the outflow, the ready lists and the boards' own list come back as plain data", async () => {
6170 app.db.run("PRAGMA wal_checkpoint(TRUNCATE)");
62 const worker = new Worker(new URL("../src/flow/pages_worker.ts", import.meta.url).href);
71 const worker = warm.shift()!;
6372 try {
6473 const now = Date.now();
6574 const answer = await ask(worker, 1, { kind: "boards", viewer: "owner", now, boardsSince: 0, out: null });
@@ -113,7 +122,7 @@ describe("a board's panels and the data page's query are read, and a board's cha
113122 const made = await writeBoard(app, seed.owner, "mine", { title: "Mine", range: "7d", refresh: "off", panels: [{ title: "Runs", chart: "line", query: { source: "runs", aggregate: "count", groupBy: { bucket: "day" } }, w: 1, h: 1 }] });
114123 expect(made.ok).toBe(true);
115124 app.db.run("PRAGMA wal_checkpoint(TRUNCATE)");
116 const worker = new Worker(new URL("../src/flow/pages_worker.ts", import.meta.url).href);
125 const worker = warm.shift()!;
117126 try {
118127 const now = Date.now();
119128 const board = (await ask(worker, 1, { kind: "board", slug: "mine", now, boardsSince: 0 })).picture as BoardPicture;

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs