24 lines
1015 B
TypeScript
24 lines
1015 B
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert";
|
|
import { groups, packages, toDirs } from "../src/packages.js";
|
|
|
|
test("toDirs falls back to the package name when no dir is set", () => {
|
|
assert.deepStrictEqual(toDirs(["waybar", "kitty"]), ["waybar", "kitty"]);
|
|
});
|
|
|
|
test("toDirs falls back to the raw name for unknown packages", () => {
|
|
assert.deepStrictEqual(toDirs(["not-a-real-package"]), ["not-a-real-package"]);
|
|
});
|
|
|
|
test("groups contains exactly the distinct group values declared on packages, no duplicates", () => {
|
|
const expected = [...new Set(packages.filter((p) => p.group).map((p) => p.group!))];
|
|
assert.deepStrictEqual(groups, expected);
|
|
assert.strictEqual(new Set(groups).size, groups.length, "groups should have no duplicates");
|
|
});
|
|
|
|
test("every grouped package's group appears in the groups list", () => {
|
|
for (const pkg of packages.filter((p) => p.group)) {
|
|
assert.ok(groups.includes(pkg.group!), `${pkg.name}'s group "${pkg.group}" missing from groups`);
|
|
}
|
|
});
|