Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated README.md to include object compare #94

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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)