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

x/unitest/matcher/to_be_after.ts>toBeAfter

🃏 Deno-first universal unit testing framework
Latest
function toBeAfter
import { toBeAfter } from "https://deno.land/x/unitest@v1.0.0-beta.82/matcher/to_be_after.ts";

Use .toBeAfter when checking if a date occurs after date

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

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

test("passes when input is after date", () => {
  expect(new Date("01/01/2019")).toBeAfter(new Date("01/01/2018"));
  expect(new Date("01/01/2018")).not.toBeAfter(new Date("01/01/2019"));
});

Parameters

actual: Date
expected: Date

Returns

MatchResult