UNPKG

984 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const spying_1 = require("../spying");
4class SpyCall {
5 constructor(args) {
6 this._args = [];
7 this._args = args;
8 }
9 get args() {
10 return this._args;
11 }
12 allArgumentsMatch(...expectedArguments) {
13 if (expectedArguments.length !== this._args.length) {
14 return false;
15 }
16 if (expectedArguments.some((arg, index) => !this._argumentIsAsExpected(this._args[index], arg))) {
17 return false;
18 }
19 return true;
20 }
21 _argumentIsAsExpected(actualArgument, expectedArgument) {
22 if (expectedArgument === spying_1.Any) {
23 return true;
24 }
25 else if (expectedArgument instanceof spying_1.TypeMatcher) {
26 return expectedArgument.test(actualArgument);
27 }
28 return actualArgument === expectedArgument;
29 }
30}
31exports.SpyCall = SpyCall;
32//# sourceMappingURL=spy-call.js.map
\No newline at end of file