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