import { toBeDateString } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/mod.ts";
Use .toBeDateString
when checking if a value is a valid date string
import {
defineExpect,
not,
test,
toBeDateString,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";
const expect = defineExpect({
matcherMap: {
toBeDateString,
},
modifierMap: {
not,
},
});
test("passes when value is a valid toBeDateString", () => {
expect("2019-11-27T14:05:07.520Z").toBeDateString();
expect("11/12/21").toBeDateString();
expect("not a date").not.toBeDateString();
});