@rws-air/utils
Version:
Utilities for rws-air libraries and applications
17 lines • 712 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBeCalled = void 0;
/**
* Checks if a Jest mocked function is called a certain amount of times with a certain amount of arguments
* @param functionToBeCalled The function that has to be called
* @param calledTimes The amount of times the function should be called
* @param args Any arguments the function should be called with
*/
function toBeCalled(functionToBeCalled, calledTimes, ...args) {
expect(functionToBeCalled).toBeCalledTimes(calledTimes);
if (calledTimes > 0) {
expect(functionToBeCalled).toBeCalledWith(...args);
}
}
exports.toBeCalled = toBeCalled;
//# sourceMappingURL=ToBeCalled.js.map