test: remove layout-pinned route-registry and task-meta fixture tests
TestDashboardPagesRegistryCoversEveryRoute parsed ui/src/router/index.ts as text, and TestTaskMetaPayloadMatchesFixture plus ui/test/task-meta-snapshot pinned a formatted JSON fixture. They failed on formatting, not behaviour.
This commit is contained in:
1 parent
be1b3aa6a1
commit
35dd7489dd
8 files changed
+4
-285
No files matched your search
@@ -1,41 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
|
||||
const snapshot = await import("../src/lib/task-meta-snapshot.ts");
|
||||
|
||||
// internal/webui/testdata/task_meta.json is the served /api/task-meta payload,
|
||||
// pinned byte-for-byte by TestTaskMetaPayloadMatchesFixture. Comparing the
|
||||
// first-paint snapshot against it means a one-sided rename of any vocabulary
|
||||
// fails on whichever side was not updated.
|
||||
const fixture = JSON.parse(
|
||||
await readFile(
|
||||
new URL("../../internal/webui/testdata/task_meta.json", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
);
|
||||
|
||||
// The server emits an unset optional field (needs_you, confirm) as its zero
|
||||
// value; the snapshot omits it.
|
||||
const dropZero = (rows: Record<string, unknown>[]) =>
|
||||
rows.map((row) =>
|
||||
Object.fromEntries(
|
||||
Object.entries(row).filter(([, v]) => v !== false && v !== ""),
|
||||
),
|
||||
);
|
||||
|
||||
test("the status snapshot matches the served catalog", () => {
|
||||
assert.deepEqual(snapshot.DEFAULT_STATUSES, dropZero(fixture.statuses));
|
||||
});
|
||||
|
||||
test("the action snapshot matches the served catalog", () => {
|
||||
assert.deepEqual(snapshot.DEFAULT_ACTIONS, dropZero(fixture.actions));
|
||||
});
|
||||
|
||||
test("the change-status snapshot matches the served catalog", () => {
|
||||
assert.deepEqual(snapshot.DEFAULT_CHANGE_STATUSES, fixture.change_statuses);
|
||||
});
|
||||
|
||||
test("the config schema snapshot matches the served catalog", () => {
|
||||
assert.equal(snapshot.DEFAULT_CONFIG_SCHEMA, fixture.config_schema);
|
||||
});
|
||||
Reference in new issue
Block a user