UNPKG

@case-contract-testing/case

Version:

Next-generation contract testing suite

21 lines (20 loc) 909 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mustResolveToNumber = exports.mustResolveToString = void 0; const errors_1 = require("../../../entities/errors"); const mustResolveToString = (matcher, context) => { const stripped = context.descendAndStrip(matcher, context); if (typeof stripped !== 'string') { throw new errors_1.CaseCoreError(`Provided matcher did not resolve to a string. Instead, it resolved to: ${stripped}`, context); } return stripped; }; exports.mustResolveToString = mustResolveToString; const mustResolveToNumber = (matcher, context) => { const stripped = context.descendAndStrip(matcher, context); if (typeof stripped !== 'number') { throw new errors_1.CaseCoreError('Provided matcher did not resolve to a number', context); } return stripped; }; exports.mustResolveToNumber = mustResolveToNumber;