jest-date
Version:
Custom jest matchers to test dates
22 lines (21 loc) • 636 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBeSunday = void 0;
const date_fns_1 = require("date-fns");
const utils_1 = require("./utils");
function toBeSunday(received) {
(0, utils_1.checkDate)('received', received, toBeSunday, {
excludeExpected: true,
invert: this.isNot,
});
const messageContext = {
name: toBeSunday.name,
received,
invert: this.isNot,
};
return {
pass: (0, date_fns_1.isSunday)(received),
message: () => (0, utils_1.deriveWeekdayMessage)(messageContext),
};
}
exports.toBeSunday = toBeSunday;