src/index.test.ts522 B · typescript
import { describe, it, expect } from "vitest";
import { TrenchMap } from "./index";
describe("TrenchMap", () => {
it("should be immutable", () => {
const map1 = new TrenchMap<string, number>();
const map2 = map1.set("a", 1);
expect(map1.has("a")).toBe(false);
expect(map2.get("a")).toBe(1);
});
it("should handle deletion", () => {
const map1 = new TrenchMap([["a", 1]]);
const map2 = map1.delete("a");
expect(map1.has("a")).toBe(true);
expect(map2.has("a")).toBe(false);
});
});