Skip to content

Commit

Permalink
docs(prefer-expect-resolves): adjust incorrect example snippet (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored Oct 1, 2022
1 parent 2339fd0 commit 83c5ea9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/rules/prefer-expect-resolves.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ it('is true', async () => {
});

it('errors', async () => {
await expect(Promise.rejects('oh noes!')).rejects.toThrow('oh noes!');
await expect(Promise.reject(new Error('oh noes!'))).rejects.toThrowError(
'oh noes!',
);
});
```
4 changes: 3 additions & 1 deletion src/rules/__tests__/prefer-expect-resolves.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ ruleTester.run('prefer-expect-resolves', rule, {
`,
dedent`
it('errors', async () => {
await expect(Promise.rejects('oh noes!')).rejects.toThrow('oh noes!');
await expect(Promise.reject(new Error('oh noes!'))).rejects.toThrowError(
'oh noes!',
);
});
`,
],
Expand Down

0 comments on commit 83c5ea9

Please sign in to comment.