UNPKG

@contract-case/case-core

Version:

Core functionality for the ContractCase contract testing suite

29 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.coreShapedLike = exports.coreAndMatcher = exports.coreArrayLengthMatcher = void 0; const case_entities_internal_1 = require("@contract-case/case-entities-internal"); const coreArrayLengthMatcher = ({ minLength, maxLength, }) => ({ '_case:matcher:type': case_entities_internal_1.ARRAY_LENGTH_MATCHER_TYPE, '_case:matcher:minLength': minLength !== undefined ? minLength : 1, '_case:matcher:maxLength': maxLength !== undefined ? maxLength : case_entities_internal_1.ARRAY_LENGTH_PARAMETER_INFINITE, }); exports.coreArrayLengthMatcher = coreArrayLengthMatcher; const coreAndMatcher = (...matchers) => ({ '_case:matcher:type': case_entities_internal_1.COMBINE_MATCHERS_TYPE, '_case:matcher:children': [...matchers], }); exports.coreAndMatcher = coreAndMatcher; /** * Everything inside this matcher will be matched on the shape of the data (ie, type alone), unless overriden with other matchers * * Use this to switch out of the default `exactlyLike` matching. * * @param content - The example object, array, primitive or matcher to match against */ const coreShapedLike = (content) => ({ '_case:matcher:type': case_entities_internal_1.CASCADING_CONTEXT_MATCHER_TYPE, '_case:matcher:child': content, '_case:context:matchBy': 'type', }); exports.coreShapedLike = coreShapedLike; //# sourceMappingURL=auxiliary.js.map