You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
939 B

import { describe, expect, it } from "vitest";
import { Container } from "pixi.js";
import { NodeRegistry } from "@/kernel/NodeRegistry";
describe("NodeRegistry", () => {
it("stores and retrieves node references by key", () => {
const registry = new NodeRegistry();
const node = new Container();
registry.set("hud:score", node);
expect(registry.get("hud:score")).toBe(node);
expect(registry.has("hud:score")).toBe(true);
expect(registry.size()).toBe(1);
});
it("removes and clears registered nodes", () => {
const registry = new NodeRegistry();
const a = new Container();
const b = new Container();
registry.set("overlay:a", a);
registry.set("overlay:b", b);
expect(registry.delete("overlay:a")).toBe(true);
expect(registry.has("overlay:a")).toBe(false);
registry.clear();
expect(registry.has("overlay:b")).toBe(false);
expect(registry.size()).toBe(0);
});
});