Files
PBandDev 2d094554f7 Bundle the pure core API for Node consumers (#6)
* feat: extract pure core api

* refactor: centralize core api helpers

* build: bundle core api output
2026-03-24 12:41:54 -05:00

24 lines
748 B
TypeScript

import { describe, expect, it } from "vitest";
import {
fromGroupLayoutId,
fromNumericGroupLayoutId,
toGroupLayoutId,
} from "../../src/layout/group-ids";
describe("group layout ids", () => {
it("namespaces string and numeric ids consistently", () => {
expect(toGroupLayoutId("abc")).toBe("group:abc");
expect(toGroupLayoutId(42)).toBe("group:42");
});
it("parses raw ids back out of namespaced ids", () => {
expect(fromGroupLayoutId("group:abc")).toBe("abc");
expect(fromGroupLayoutId("node:abc")).toBeNull();
});
it("parses numeric group ids when they are valid numbers", () => {
expect(fromNumericGroupLayoutId("group:42")).toBe(42);
expect(fromNumericGroupLayoutId("group:abc")).toBeNull();
});
});