Skip to content

Commit 83c5ea9

Browse files
authored
docs(prefer-expect-resolves): adjust incorrect example snippet (#1253)
1 parent 2339fd0 commit 83c5ea9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/rules/prefer-expect-resolves.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ it('is true', async () => {
5858
});
5959

6060
it('errors', async () => {
61-
await expect(Promise.rejects('oh noes!')).rejects.toThrow('oh noes!');
61+
await expect(Promise.reject(new Error('oh noes!'))).rejects.toThrowError(
62+
'oh noes!',
63+
);
6264
});
6365
```

src/rules/__tests__/prefer-expect-resolves.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ ruleTester.run('prefer-expect-resolves', rule, {
2727
`,
2828
dedent`
2929
it('errors', async () => {
30-
await expect(Promise.rejects('oh noes!')).rejects.toThrow('oh noes!');
30+
await expect(Promise.reject(new Error('oh noes!'))).rejects.toThrowError(
31+
'oh noes!',
32+
);
3133
});
3234
`,
3335
],

0 commit comments

Comments
 (0)