Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
robinpokorny committed Mar 25, 2017
1 parent 38e7961 commit 0c991d6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/ExpectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ Moreover, this code tests that the returned reason includes 'octopus'`:
```js
test('fetchData() rejects to be error', async () => {
const drinkOctopus = new Promise(() => {
throw 'yuck, octopus flavor'
})
throw new DisgustingFlavorError('yuck, octopus flavor');
});

await expect(drinkOctopus).rejects.toMatch('octopus');
});
Expand Down
2 changes: 1 addition & 1 deletion docs/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test('the data is peanut butter', () => {

Be sure to return the assertion—if you omit this `return` statement, your test will complete before `fetchData` completes.

If you expect a promise to be rejected use the .rejects` matcher. It works analogically to the .resolves` matcher. If the promise is fulfilled, the test will automatically fail.
If you expect a promise to be rejected use the `.rejects` matcher. It works analogically to the `.resolves` matcher. If the promise is fulfilled, the test will automatically fail.

```js
test('the fetch fails with an error', () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/async/__tests__/user-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as user from '../user';

// The assertion for a promise must be returned.
it('works with promises', () => {
return expect(user.getUserName(5)).resolves.toEqual('Paul'));
return expect(user.getUserName(5)).resolves.toEqual('Paul');
});

// async/await can also be used.
Expand Down

0 comments on commit 0c991d6

Please sign in to comment.