Debian Codegraph @

frontend/test/account.test.ts

raw
1 import { test } from "uvu";
2 import assert from "uvu/assert";
3
4 import { isDescendant, leaf, parent } from "../src/lib/account";
5
6 test("account: split account names", () => {
7 assert.is(parent("asd:asdf"), "asd");
8 assert.is(parent("asd"), "");
9 assert.is(parent(""), "");
10 assert.is(leaf("asd:asdf"), "asdf");
11 assert.is(leaf("asd"), "asd");
12 assert.is(leaf(""), "");
13 });
14
15 test("account: check whether account is descendant of another", () => {
16 assert.is(true, isDescendant("A", ""));
17 assert.is(true, isDescendant("A:Test", ""));
18 assert.is(true, isDescendant("A", "A"));
19 assert.is(true, isDescendant("A:Test", "A"));
20 assert.is(false, isDescendant("ATest", "A"));
21 });
22
23 test.run();