feat(lab): standardize evidence workspace template
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { after, before, test } from "node:test";
|
||||
|
||||
import { createServer } from "vite";
|
||||
|
||||
let server;
|
||||
let productModel;
|
||||
|
||||
before(async () => {
|
||||
server = await createServer({
|
||||
appType: "custom",
|
||||
logLevel: "silent",
|
||||
server: { middlewareMode: true },
|
||||
});
|
||||
productModel = await server.ssrLoadModule("/src/productModel.ts");
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await server?.close();
|
||||
});
|
||||
|
||||
test("top navigation has no Center and Park owns contour health first", () => {
|
||||
assert.deepEqual(
|
||||
productModel.roots.map((root) => root.id),
|
||||
["fleet", "observation", "missions", "data", "system", "polygon"],
|
||||
);
|
||||
assert.equal(productModel.workspacesForRoot("fleet")[0]?.id, "contour-health");
|
||||
assert.equal(productModel.workspaceById("contour-health")?.root, "fleet");
|
||||
});
|
||||
|
||||
test("every laboratory result uses the shared evidence template", async () => {
|
||||
const source = await readFile(
|
||||
new URL("../src/workspaces/Workspaces.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const css = await readFile(
|
||||
new URL("../src/styles/workspaces.css", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const app = await readFile(
|
||||
new URL("../src/App.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
assert.match(source, /function LaboratoryWorkTemplate\(/);
|
||||
assert.match(source, /function LaboratoryEvidence\(/);
|
||||
assert.match(source, /data-viewer-focused=/);
|
||||
assert.match(css, /height:\s*clamp\(42rem,\s*68vh,\s*58rem\)/);
|
||||
assert.match(css, /resize:\s*vertical/);
|
||||
assert.match(app, /activeDefinition\?\.kind === "lab-archive"/);
|
||||
});
|
||||
Reference in New Issue
Block a user