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
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,12 @@
1
-
# substitute.js
2
1
[`@fluffy-spoon/substitute`](https://www.npmjs.com/package/@fluffy-spoon/substitute) is a TypeScript port of [NSubstitute](http://nsubstitute.github.io), which aims to provide a much more fluent mocking opportunity for strong-typed languages.
3
2
4
-
##Installing
3
+
# Installing
5
4
`npm install @fluffy-spoon/substitute --save-dev`
6
5
7
-
##Requirements
6
+
# Requirements
8
7
*`TypeScript^3.0.0`
9
8
10
-
## Usage
11
-
Experience full strong-typing of your fakes all the way, and let the TypeScript compiler help with all the dirty work! All methods below have full strong typing all around, even when creating a fake from an interface!
There are several ways of matching arguments. You don't have to be explicit.
48
+
## Argument matchers
49
+
There are several ways of matching arguments. The examples below also applies to properties and fields.
53
50
54
51
```typescript
55
52
import { Arg } from'@fluffy-spoon/substitute';
@@ -61,7 +58,4 @@ console.log(calculator.add(1337, 2)); //prints 10 since second argument matches
61
58
62
59
//received call with first arg 1 and second arg less than 0
63
60
calculator.received().add(1, Arg.is(x=>x<0));
64
-
```
65
-
66
-
## What is this - black magic?
67
-
`@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