import { toBeBetween } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_be_between.ts";
Use .toBeBetween
when checking if a date equals or occurs after startDate
and equals or occurs before endDate
import {
defineExpect,
not,
test,
toBeBetween,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toBeBetween,
},
modifierMap: {
not,
},
});
test("passes when input is in given date range", () => {
expect(new Date("05/01/2019")).toBeBetween(
new Date("01/01/2019"),
new Date("10/01/2019"),
);
expect(new Date("05/01/2019")).toBeBetween(
new Date("05/01/2019"),
new Date("10/01/2019"),
);
expect(new Date("01/01/2019")).not.toBeBetween(
new Date("05/01/2019"),
new Date("10/01/2019"),
);
});