import { toIncludeSameMembers } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/mod.ts";
Use .toIncludeSameMembers
when checking if two arrays contain equal values, in
any order
import {
defineExpect,
not,
test,
toIncludeSameMembers,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toIncludeSameMembers,
},
modifierMap: {
not,
},
});
test("passes when arrays match in a different order", () => {
expect([1, 2, 3]).toIncludeSameMembers([3, 1, 2]);
expect([{ foo: "bar" }, { baz: "qux" }]).toIncludeSameMembers([
{ baz: "qux" },
{ foo: "bar" },
]);
});