import { toContainEntries } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/mod.ts";
Use .toContainEntries
when checking if an object contains all of the provided
entries
import {
defineExpect,
not,
test,
toContainEntries,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toContainEntries,
},
modifierMap: {
not,
},
});
test("passes when object contains all of the given entries", () => {
const object = { a: "foo", b: "bar", c: "baz" };
expect(object).toContainEntries([["a", "foo"]]);
expect(object).toContainEntries([
["c", "baz"],
["a", "foo"],
]);
expect(object).not.toContainEntries([
["b", "qux"],
["a", "foo"],
]);
});