swarm-ui: ignore a saved table filter whose column is gone
This commit is contained in:
parent
71e303ed62
commit
885c051b33
3 changed files with 43 additions and 1 deletions
19
frontend/packages/swarm-ui/test/table-filters.test.mjs
Normal file
19
frontend/packages/swarm-ui/test/table-filters.test.mjs
Normal 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"]), {});
|
||||
});
|
||||
Loading…
Reference in a new issue