UNPKG

jest-date

Version:

Custom jest matchers to test dates

20 lines (19 loc) 620 B
/// <reference types="jest" /> declare global { namespace jest { interface Matchers<R, T> { /** * Assert whether a date is the same second as another. * @param {Date} date - Date to compare to * @example * expect(new Date(2020, 8, 1, 12, 30, 10)) * .toBeSameSecondAs(new Date(2020, 8, 1, 12, 30, 10)) */ toBeSameSecondAs(date: Date): R; } } } export declare function toBeSameSecondAs(this: jest.MatcherUtils, received: Date, expected: Date): { pass: boolean; message: () => string; };