updeep/esm/reject.test.js

20 lines
601 B
JavaScript
Raw Permalink Normal View History

2025-01-31 17:50:51 +00:00
import { expect, test } from "vitest";
import reject from "./reject.js";
import u from "./index.js";
test("can reject", () => {
const result = u({
foo: reject((_, k) => k === 1),
})({
foo: ["a", "b"],
});
expect(result).to.eql({ foo: ["a"] });
});
test("freezes the result", () => {
expect(Object.isFrozen(reject([1], () => true))).to.be.true;
});
test("doesn't change the obj if nothing is modified", () => {
const orig = [1, 2, 3];
const result = reject(() => false)(orig);
expect(result).to.be.equal(orig);
});
//# sourceMappingURL=reject.test.js.map