mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
Filter conditions and groups, delivery targets, saved fragments and forge hosts vanished on a single click, taking whatever had been typed with them. Rows holding content now ask first, while empty, never-filled rows (`isBlankNode`: default operator, no path, no values, not negated) are still removed directly.
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { describe, it, expect } from "bun:test";
|
|
import { blankNode, isBlankNode } from "../app/composables/useFilterNode";
|
|
|
|
describe("isBlankNode", () => {
|
|
it("treats untouched conditions and groups as blank", () => {
|
|
expect(isBlankNode(blankNode("leaf"))).toBe(true);
|
|
expect(isBlankNode(blankNode("all"))).toBe(true);
|
|
expect(isBlankNode(blankNode("not"))).toBe(true);
|
|
});
|
|
|
|
it("treats any value, path or negation as content", () => {
|
|
const withValue = blankNode("all");
|
|
withValue.children[0]!.leaf.values = ["push"];
|
|
expect(isBlankNode(withValue)).toBe(false);
|
|
const negated = blankNode("leaf");
|
|
negated.leaf.exclude = true;
|
|
expect(isBlankNode(negated)).toBe(false);
|
|
const withPath = blankNode("leaf");
|
|
withPath.leaf.path = "sender.login";
|
|
expect(isBlankNode(withPath)).toBe(false);
|
|
// `exists` is a complete condition without any value.
|
|
const exists = blankNode("all");
|
|
exists.children[0]!.leaf.type = "branch";
|
|
exists.children[0]!.leaf.op = "exists";
|
|
expect(isBlankNode(exists)).toBe(false);
|
|
});
|
|
});
|