Skip to main content
Module

x/unitest/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/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