UNPKG

alsatian

Version:

TypeScript and JavaScript testing framework for beautiful and readable tests

32 lines 984 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const spying_1 = require("../spying"); class SpyCall { constructor(args) { this._args = []; this._args = args; } get args() { return this._args; } allArgumentsMatch(...expectedArguments) { if (expectedArguments.length !== this._args.length) { return false; } if (expectedArguments.some((arg, index) => !this._argumentIsAsExpected(this._args[index], arg))) { return false; } return true; } _argumentIsAsExpected(actualArgument, expectedArgument) { if (expectedArgument === spying_1.Any) { return true; } else if (expectedArgument instanceof spying_1.TypeMatcher) { return expectedArgument.test(actualArgument); } return actualArgument === expectedArgument; } } exports.SpyCall = SpyCall; //# sourceMappingURL=spy-call.js.map