UNPKG

chai-callslike

Version:

A simple sinon-chai assertion to validate many aspects of stub calls

30 lines (29 loc) 988 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.printComparison = exports.printValue = void 0; const colors_1 = require("./colors"); const is_matcher_1 = require("./is-matcher"); const describe_matcher_1 = require("./describe-matcher"); const stringify_1 = require("./stringify"); function printValue(value) { let result; if (is_matcher_1.isMatcher(value)) { result = describe_matcher_1.describeMatcher(value); } else { result = stringify_1.stringify(value); if (result.startsWith('{')) { result = `<${value['constructor'].name}>${result}`; } } return result; } exports.printValue = printValue; function printComparison(actualInfo, expectedInfo) { let result = `${colors_1.wrong(actualInfo)} ${colors_1.right(expectedInfo)}`; if (expectedInfo === actualInfo) { result += ' (different instances)'; } return result; } exports.printComparison = printComparison;