Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
16 changes: 16 additions & 0 deletions docs/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,22 @@ test('drinkEach drinks each drink', () => {
});
```

### `.toHaveReturned(value)`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should doc every new matcher, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: still needs docs

Oh, ignore me then :D


Also under the alias: `.toReturn(value)`

If you have a mock function, you can use `.toHaveReturned` to test that the spy
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call it "spy"?

returned a value. For example, let's say you have a mock `drink` that returns
`true`. You can write:

```js
test('drinks returns true', () => {
const drink = jest.fn(() => true);
drink();
expect(drink).toHaveReturned(true);
});
```

### `.toBeCloseTo(number, numDigits)`

Using exact equality with floating point numbers is a bad idea. Rounding means
Expand Down
Loading