Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/unitest/matcher/mod.ts>toBeDateString

🃏 Deno-first universal unit testing framework
Latest
function toBeDateString
Re-export
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();
});

Parameters

actual: string