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) • 474 B
text/typescript
import { arrayReplaceOne } from "./array-replace-one.js";
import { Test_setDefaultFlags } from "../../test-util/test_set-default-flags.js";
describe("=> arrayReplaceOne", () =>
{
beforeEach(() =>
{
Test_setDefaultFlags();
});
const a = ["a", "b", "b", "c"];
it("| replaces a single match from the first argument", () =>
{
expect(arrayReplaceOne(a, "b", "e")).toBeTrue();
expect(a).toEqual(["a", "e", "b", "c"]);
});
});