formats.exposed/test/common/nodePath.test.ts

25 lines
596 B
TypeScript
Raw Normal View History

import { assert, assertEquals } from "assert";
import {
isEqualTo,
isSupersetOf,
parse,
} from "../../public/common/nodePath.js";
Deno.test("parse", () => {
assertEquals(parse(""), []);
assertEquals(parse("1"), [1]);
assertEquals(parse("1,2,3"), [1, 2, 3]);
});
Deno.test("isEqualTo", () => {
assert(isEqualTo([], []));
assert(isEqualTo([1, 2, 3], [1, 2, 3]));
assert(!isEqualTo([1, 2], [1, 2, 3]));
});
Deno.test("isSupersetOf", () => {
assert(isSupersetOf([1, 2, 3], [1, 2, 3]));
assert(isSupersetOf([1, 2], [1, 2, 3]));
assert(!isSupersetOf([1, 2, 3], [1, 2]));
});