Skip to content

Commit

Permalink
Revert "fix: valid-expect logic"
Browse files Browse the repository at this point in the history
This reverts commit ae8ecac.
  • Loading branch information
y-hsgw committed May 23, 2024
1 parent ae8ecac commit 9d15df1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 188 deletions.
168 changes: 2 additions & 166 deletions src/rules/__tests__/valid-expect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
column: 12,
endColumn: 4,
messageId: 'asyncMustBeAwaited',
},
{
column: 9,
endColumn: 43,
Expand Down Expand Up @@ -468,11 +463,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
column: 12,
endColumn: 4,
messageId: 'asyncMustBeAwaited',
},
{
column: 9,
endColumn: 43,
Expand Down Expand Up @@ -504,11 +494,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
column: 12,
endColumn: 4,
messageId: 'asyncMustBeAwaited',
},
{
column: 9,
endColumn: 43,
Expand All @@ -523,12 +508,6 @@ ruleTester.run('valid-expect', rule, {
output:
'test("valid-expect", async () => { await expect(Promise.resolve(2)).resolves.toBeDefined(); });',
errors: [
{
column: 22,
endColumn: 82,
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
column: 30,
endColumn: 79,
Expand All @@ -542,12 +521,6 @@ ruleTester.run('valid-expect', rule, {
output:
'test("valid-expect", async () => { await expect(Promise.resolve(2)).toResolve(); });',
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand All @@ -562,12 +535,6 @@ ruleTester.run('valid-expect', rule, {
'test("valid-expect", async () => { await expect(Promise.resolve(2)).toResolve(); });',
options: [{ asyncMatchers: undefined }],
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand All @@ -581,12 +548,6 @@ ruleTester.run('valid-expect', rule, {
output:
'test("valid-expect", async () => { await expect(Promise.resolve(2)).toReject(); });',
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand All @@ -600,12 +561,6 @@ ruleTester.run('valid-expect', rule, {
output:
'test("valid-expect", async () => { await expect(Promise.resolve(2)).not.toReject(); });',
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand All @@ -620,12 +575,6 @@ ruleTester.run('valid-expect', rule, {
output:
'test("valid-expect", async () => { await expect(Promise.resolve(2)).resolves.not.toBeDefined(); });',
errors: [
{
column: 22,
endColumn: 86,
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
column: 30,
endColumn: 83,
Expand All @@ -640,12 +589,6 @@ ruleTester.run('valid-expect', rule, {
output:
'test("valid-expect", async () => { await expect(Promise.resolve(2)).rejects.toBeDefined(); });',
errors: [
{
column: 22,
endColumn: 81,
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
column: 30,
endColumn: 78,
Expand All @@ -660,12 +603,6 @@ ruleTester.run('valid-expect', rule, {
output:
'test("valid-expect", async () => { await expect(Promise.resolve(2)).rejects.not.toBeDefined(); });',
errors: [
{
column: 22,
endColumn: 85,
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
column: 30,
endColumn: 82,
Expand Down Expand Up @@ -707,11 +644,6 @@ ruleTester.run('valid-expect', rule, {
'test("valid-expect", async () => { await expect(Promise.reject(2)).toRejectWith(2); });',
options: [{ asyncMatchers: ['toRejectWith'] }],
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand All @@ -725,11 +657,6 @@ ruleTester.run('valid-expect', rule, {
'test("valid-expect", async () => { await expect(Promise.reject(2)).rejects.toBe(2); });',
options: [{ asyncMatchers: ['toRejectWith'] }],
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand Down Expand Up @@ -911,13 +838,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
line: 1,
column: 22,
endColumn: 2,
messageId: 'promisesWithAsyncAssertionsMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 2,
column: 3,
Expand All @@ -939,13 +859,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
line: 1,
column: 22,
endColumn: 2,
messageId: 'promisesWithAsyncAssertionsMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 2,
column: 3,
Expand Down Expand Up @@ -988,13 +901,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
line: 1,
column: 22,
endColumn: 2,
messageId: 'promisesWithAsyncAssertionsMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 2,
column: 3,
Expand All @@ -1018,12 +924,6 @@ ruleTester.run('valid-expect', rule, {
`,
options: [{ alwaysAwait: true }],
errors: [
{
line: 1,
column: 22,
endColumn: 2,
messageId: 'promisesWithAsyncAssertionsMustBeAwaited',
},
{
line: 2,
column: 3,
Expand Down Expand Up @@ -1051,14 +951,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
line: 1,
column: 22,
endLine: 6,
endColumn: 2,
messageId: 'promisesWithAsyncAssertionsMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 2,
column: 3,
Expand Down Expand Up @@ -1088,14 +980,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
line: 1,
column: 22,
endLine: 6,
endColumn: 2,
messageId: 'promisesWithAsyncAssertionsMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 2,
column: 3,
Expand Down Expand Up @@ -1124,22 +1008,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
line: 1,
column: 22,
endLine: 6,
endColumn: 2,
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 1,
column: 22,
endLine: 6,
endColumn: 2,
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 3,
column: 5,
Expand Down Expand Up @@ -1170,24 +1038,12 @@ ruleTester.run('valid-expect', rule, {
output: dedent`
test("valid-expect", async () => {
const assertions = [
await expect(Promise.resolve(2)).toResolve(),
await expect(Promise.resolve(3)).toReject(),
expect(Promise.resolve(2)).toResolve(),
expect(Promise.resolve(3)).toReject(),
]
});
`,
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand Down Expand Up @@ -1220,18 +1076,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
column: 22,
line: 1,
},
{
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
Expand Down Expand Up @@ -1272,14 +1116,6 @@ ruleTester.run('valid-expect', rule, {
});
`,
errors: [
{
line: 2,
column: 71,
endLine: 4,
endColumn: 4,
messageId: 'asyncMustBeAwaited',
data: { orReturned: ' or returned' },
},
{
line: 3,
column: 5,
Expand Down
Loading

0 comments on commit 9d15df1

Please sign in to comment.