import { toBeWithin } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/mod.ts";
Use .toBeWithin
when checking if a number
is in between the given bounds of:
start (inclusive) and end (exclusive)
import {
defineExpect,
not,
test,
toBeWithin,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toBeWithin,
},
modifierMap: {
not,
},
});
test("passes when number is within given bounds", () => {
expect(1).toBeWithin(1, 3);
expect(2).toBeWithin(1, 3);
expect(3).not.toBeWithin(1, 3);
});