@contract-case/case-core
Version:
Core functionality for the ContractCase contract testing suite
19 lines • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BooleanMatcher = void 0;
const case_plugin_base_1 = require("@contract-case/case-plugin-base");
const testExactMatch_1 = require("./internal/testExactMatch");
const check = (matcher, matchContext, actual) => (0, case_plugin_base_1.combineResults)(matchContext['_case:context:matchBy'] === 'exact'
? (0, testExactMatch_1.testExactMatch)(matcher, matchContext, actual)
: (0, case_plugin_base_1.makeResults)(), typeof actual !== 'boolean'
? (0, case_plugin_base_1.makeResults)((0, case_plugin_base_1.matchingError)(matcher, `${(0, case_plugin_base_1.actualToString)(actual)} is not a boolean`, actual, matchContext))
: (0, case_plugin_base_1.makeResults)());
exports.BooleanMatcher = {
describe: (matcher, matchContext) => matchContext['_case:context:matchBy'] === 'exact'
? `${matcher['_case:matcher:example']}`
: '<any boolean>',
check,
strip: (matcher) => matcher['_case:matcher:example'],
validate: () => Promise.resolve(),
};
//# sourceMappingURL=BooleanMatcher.js.map