import { toIncludeRepeated } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/mod.ts";
Use .toIncludeRepeated
when checking if a string
includes the given string
substring the correct number of times
import {
defineExpect,
not,
test,
toIncludeRepeated,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toIncludeRepeated,
},
modifierMap: {
not,
},
});
test("passes when value includes substring n times", () => {
expect("hello hello world").toIncludeRepeated("hello", 2);
expect("hello hello world").not.toIncludeRepeated("hello", 1);
});