Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,25 @@ when(mockedFoo.sumTwoNumbers(anyNumber(), anyNumber())).thenCall((arg1:number, a
console.log(foo.sumTwoNumbers(5, 10));
```

### Using matchers to verify

DeepEqualMatcher to compare objects

``` typescript
// Creating mock
let mockedFoo:Foo = mock(Foo);

// Getting instance
let foo:Foo = instance(mockedFoo);

// Some calls
foo.getBar({ foo: "bar" });

// Use deepEqual to verify objects
verify(mockedFoo.getBar(deepEqual({ foo: "bar" }))).called(); // Was called with object only once
```


### Resolving / rejecting promises

You can also stub method to resolve / reject promise
Expand Down Expand Up @@ -361,4 +380,4 @@ console.log(capture(spiedFoo.bar).last()); // [42]
* Andrey Ermakov (https://github.com/dreef3)
* Markus Ende (https://github.com/Markus-Ende)
* Thomas Hilzendegen (https://github.com/thomashilzendegen)
* Johan Blumenberg (https://github.com/johanblumenberg)
* Johan Blumenberg (https://github.com/johanblumenberg)