Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: ignore a saved table filter whose column is gone

This commit is contained in:
iris 2026-10-21 21:08:26 +02:00 • committed by mara
commit 885c051b33
3 changed files with 43 additions and 1 deletions

View file

@ -0,0 +1,19 @@
// Which remembered table filters still apply. Run by `npm test`, which Node
// runs with its built-in test runner and type stripping, so the `.ts` module
// is imported as it is.
import assert from "node:assert/strict";
import { test } from "node:test";
import { forExistingColumns } from "../src/ui/table/table-filters.ts";
test("a filter on a column that is gone is ignored", () => {
const saved = { status: { value: "up" }, oldName: { value: "x" } };
assert.deepEqual(forExistingColumns(saved, ["status", "name"]), {
status: { value: "up" },
});
});
test("filters on columns that all exist are kept, and none is fine", () => {
const saved = { a: 1, b: 2 };
assert.deepEqual(forExistingColumns(saved, ["a", "b"]), saved);
assert.deepEqual(forExistingColumns({}, ["a"]), {});
});