import { toContainAnyKeys } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_contain_any_keys.ts";
Use .toContainAnyKeys
when checking if an object contains at least one of the
provided keys
import {
defineExpect,
not,
test,
toContainAnyKeys,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toContainAnyKeys,
},
modifierMap: {
not,
},
});
test("passes when object contains at least one matching key", () => {
const object = { a: "hello", b: "world" };
expect(object).toContainAnyKeys(["a"]);
expect(object).toContainAnyKeys(["b", "c"]);
expect(object).not.toContainAnyKeys(["c"]);
});