Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/unitest/matcher/mod.ts>toBeDate

๐Ÿƒ Deno-first universal unit testing framework
Latest
function toBeDate
Re-export
import { toBeDate } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/mod.ts";

Use .toBeDate when checking if a value is a Date

import {
  defineExpect,
  not,
  test,
  toBeDate,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";

const expect = defineExpect({
  matcherMap: {
    toBeDate,
  },
  modifierMap: {
    not,
  },
});

test("passes when value is a date", () => {
  expect(new Date("01/01/2018")).toBeDate();
  expect("01/01/2018").not.toBeDate();
  expect(undefined).not.toBeDate();
});

Parameters

actual: unknown