You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several ways of matching arguments. You don't have to be explicit.
53
+
54
+
```typescript
55
+
import { Arg } from'@fluffy-spoon/substitute';
56
+
57
+
//ignoring arguments
58
+
calculator.add(Arg.any(), 2).returns(10);
59
+
console.log(calculator.add(1337, 3)); //prints undefined since second argument doesn't match
60
+
console.log(calculator.add(1337, 2)); //prints 10 since second argument matches
61
+
calculator.received().add(Arg.any(), 3); //will not throw since a call matches
62
+
63
+
//ignoring arguments of specific type
64
+
calculator.add(Arg.any('number'), 2).returns(10); //could also be 'array' or any string returned by the typeof operator
65
+
```
66
+
31
67
## What is this - black magic?
32
68
`@fluffy-spoon/substitute` works the same way that NSubstitute does, except that it uses the EcmaScript 6 `Proxy` class to produce the fakes. You can read more about how NSubstitute works to get inspired.
0 commit comments