jest-date
Version:
Custom jest matchers to test dates
19 lines (18 loc) • 565 B
TypeScript
/// <reference types="jest" />
declare global {
namespace jest {
interface Matchers<R, T> {
/**
* Assert whether a date is the same year as another.
* @param {Date} date - Date to compare to
* @example
* expect(new Date(2020, 1)).toBeSameYearAs(new Date(2020, 7))
*/
toBeSameYearAs(date: Date): R;
}
}
}
export declare function toBeSameYearAs(this: jest.MatcherUtils, received: Date, expected: Date): {
pass: boolean;
message: () => string;
};