UNPKG

@contract-case/case-core

Version:

Core functionality for the ContractCase contract testing suite

20 lines 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LookupMatcher = void 0; const case_plugin_base_1 = require("@contract-case/case-plugin-base"); const getMatcher = (matcher, matchContext) => { if ('_case:matcher:child' in matcher && matcher['_case:matcher:child'] !== undefined) { matchContext.saveLookupableMatcher(matcher); } return matchContext.lookupMatcher(matcher['_case:matcher:uniqueName']); }; const strip = (matcher, matchContext) => matchContext.descendAndStrip(getMatcher(matcher, matchContext), (0, case_plugin_base_1.addLocation)(`:lookup[${matcher['_case:matcher:uniqueName']}]`, matchContext)); const check = async (matcher, matchContext, actual) => matchContext.descendAndCheck(getMatcher(matcher, matchContext), (0, case_plugin_base_1.addLocation)(`:lookup[${matcher['_case:matcher:uniqueName']}]`, matchContext), actual); exports.LookupMatcher = { describe: (matcher, matchContext) => matchContext.descendAndDescribe(getMatcher(matcher, matchContext), (0, case_plugin_base_1.addLocation)(`:lookup[${matcher['_case:matcher:uniqueName']}]`, matchContext)), check, strip, validate: (matcher, matchContext) => Promise.resolve().then(() => matchContext.descendAndValidate(getMatcher(matcher, matchContext), (0, case_plugin_base_1.addLocation)(`:lookup[${matcher['_case:matcher:uniqueName']}]`, matchContext))), }; //# sourceMappingURL=LookupMatcher.js.map