earljs
Version:
Ergonomic, modern and type-safe assertion library
23 lines (22 loc) • 714 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBeFalsy = exports.toBeTruthy = void 0;
const format_1 = require("../format");
function toBeTruthy(control) {
const fmt = (0, format_1.formatCompact)(control.actual);
control.assert({
success: Boolean(control.actual),
reason: `${fmt} is not truthy`,
negatedReason: `${fmt} is truthy`,
});
}
exports.toBeTruthy = toBeTruthy;
function toBeFalsy(control) {
const fmt = (0, format_1.formatCompact)(control.actual);
control.assert({
success: !control.actual,
reason: `${fmt} is not falsy`,
negatedReason: `${fmt} is falsy`,
});
}
exports.toBeFalsy = toBeFalsy;
;