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_or_equal_to.ts>toBeAfterOrEqualTo

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

Use .toBeAfterOrEqualTo when checking if a date equals to or occurs after date

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

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

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

Parameters

actual: Date
expected: Date