UNPKG

chai-callslike

Version:

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

16 lines (15 loc) 685 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSomeAssertFunction = void 0; const colors_1 = require("./colors"); const check_some_calls_error_1 = require("./check-some-calls-error"); function getSomeAssertFunction(_chai, utils, compareFunc) { return function fn(...expectedCalls) { const actualCalls = utils.flag(this, 'object'); const errors = check_some_calls_error_1.checkSomeCallsError(actualCalls, expectedCalls, compareFunc); if (errors) { _chai.assert.fail(colors_1.info(`On ${colors_1.ids(actualCalls.name)}${errors}`)); } }; } exports.getSomeAssertFunction = getSomeAssertFunction;