UNPKG

chai-callslike

Version:

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

23 lines (22 loc) 715 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.compareParameters = void 0; const colors_1 = require("./colors"); function compareParameters(actual, expected, compareFunc) { const lengthActual = actual.length; const lengthExpected = expected.length; let parValues = ''; const max = Math.min(lengthActual, lengthExpected); for (let j = 0; j < max; j++) { const result = compareFunc(actual[j], expected[j]); if (result) { parValues += ` param ${colors_1.ids(`#${j + 1}`)}: ${result}`; } } return parValues ? ` Parameters:${parValues}` : ''; } exports.compareParameters = compareParameters;