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
Copy file name to clipboardExpand all lines: README.md
+13-39Lines changed: 13 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,48 +8,22 @@ More concretely named `@fluffy-spoon/substitute` on NPM is a TypeScript port of
8
8
Experience full strong-typing of your fakes all the way, and let the TypeScript compiler help with all the dirty work! In the usage example given below, the `exFake` instance is strong-typed all the way, and can be used naturally in a fluent interface!
console.log(exFake.c("something", "there")); //prints undefined (since it doesn't match the parameters)
49
-
50
-
exFake.d.returns(9);
51
-
console.log(exFake.d); //prints 9
17
+
//Create:
18
+
var calculator =Substitute.for<Calculator>();
19
+
20
+
//Set a return value:
21
+
calculator.add(1, 2).returns(3);
22
+
23
+
//Check received calls:
24
+
calculator.received().add(1, Arg.any());
25
+
calculator.didNotReceive().add(2, 2);
52
26
```
53
27
54
-
## But how?
28
+
## What is this - black magic?
55
29
`@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