rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
18 lines (15 loc) • 407 B
text/typescript
import { mapPush } from "./map-push.js";
describe("=> mapPush", () =>
{
const values = new Map([["a", [1]]]);
it("| pushes where array exists", () =>
{
mapPush(values, "a", 2);
expect(values.get("a")).toEqual([1, 2]);
});
it("| creates array where key not defined", () =>
{
mapPush(values, "b", 3);
expect(values.get("b")).toEqual([3]);
});
});