Skip to content

Commit

Permalink
test: add a few more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Mar 2, 2022
1 parent 1911f45 commit 252e3d9
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions packages/eslint-plugin/tests/rules/no-misused-promises.test.ts
Expand Up @@ -273,6 +273,34 @@ interface ItLike {
declare const it: ItLike;
it('', async () => {});
`,
},
{
code: `
interface ItLike {
(name: string, callback: () => void): void;
}
interface ItLike {
(name: string, callback: () => Promise<void>): void;
}
declare const it: ItLike;
it('', async () => {});
`,
},
{
code: `
interface ItLike {
(name: string, callback: () => Promise<void>): void;
}
interface ItLike {
(name: string, callback: () => void): void;
}
declare const it: ItLike;
it('', async () => {});
`,
},
Expand Down Expand Up @@ -729,5 +757,45 @@ it('', async () => {});
},
],
},
{
code: `
interface ItLike {
(name: string, callback: () => number): void;
}
interface ItLike {
(name: string, callback: () => void): void;
}
declare const it: ItLike;
it('', async () => {});
`,
errors: [
{
line: 11,
messageId: 'voidReturnArgument',
},
],
},
{
code: `
interface ItLike {
(name: string, callback: () => void): void;
}
interface ItLike {
(name: string, callback: () => number): void;
}
declare const it: ItLike;
it('', async () => {});
`,
errors: [
{
line: 11,
messageId: 'voidReturnArgument',
},
],
},
],
});

0 comments on commit 252e3d9

Please sign in to comment.