Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(prefer-expect-assertions): add missing suggestions to each cases #1536

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions src/rules/__tests__/prefer-expect-assertions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,24 @@ ruleTester.run('.each support', rule, {
messageId: 'haveExpectAssertions',
column: 1,
line: 1,
suggestions: [
{
messageId: 'suggestAddingHasAssertions',
output: dedent`
test.each()("is not fine", () => {expect.hasAssertions();
expect(someValue).toBe(true);
});
`,
},
{
messageId: 'suggestAddingAssertions',
output: dedent`
test.each()("is not fine", () => {expect.assertions();
expect(someValue).toBe(true);
});
`,
},
],
},
],
},
Expand All @@ -1517,6 +1535,28 @@ ruleTester.run('.each support', rule, {
messageId: 'haveExpectAssertions',
column: 3,
line: 2,
suggestions: [
{
messageId: 'suggestAddingHasAssertions',
output: dedent`
describe.each()('something', () => {
it("is not fine", () => {expect.hasAssertions();
expect(someValue).toBe(true);
});
});
`,
},
{
messageId: 'suggestAddingAssertions',
output: dedent`
describe.each()('something', () => {
it("is not fine", () => {expect.assertions();
expect(someValue).toBe(true);
});
});
`,
},
],
},
],
},
Expand All @@ -1533,6 +1573,28 @@ ruleTester.run('.each support', rule, {
messageId: 'haveExpectAssertions',
column: 3,
line: 2,
suggestions: [
{
messageId: 'suggestAddingHasAssertions',
output: dedent`
describe.each()('something', () => {
test.each()("is not fine", () => {expect.hasAssertions();
expect(someValue).toBe(true);
});
});
`,
},
{
messageId: 'suggestAddingAssertions',
output: dedent`
describe.each()('something', () => {
test.each()("is not fine", () => {expect.assertions();
expect(someValue).toBe(true);
});
});
`,
},
],
},
],
},
Expand All @@ -1548,6 +1610,24 @@ ruleTester.run('.each support', rule, {
messageId: 'haveExpectAssertions',
column: 1,
line: 1,
suggestions: [
{
messageId: 'suggestAddingHasAssertions',
output: dedent`
test.each()("is not fine", async () => {expect.hasAssertions();
expect(someValue).toBe(true);
});
`,
},
{
messageId: 'suggestAddingAssertions',
output: dedent`
test.each()("is not fine", async () => {expect.assertions();
expect(someValue).toBe(true);
});
`,
},
],
},
],
},
Expand All @@ -1563,6 +1643,24 @@ ruleTester.run('.each support', rule, {
messageId: 'haveExpectAssertions',
column: 1,
line: 1,
suggestions: [
{
messageId: 'suggestAddingHasAssertions',
output: dedent`
it.each()("is not fine", async () => {expect.hasAssertions();
expect(someValue).toBe(true);
});
`,
},
{
messageId: 'suggestAddingAssertions',
output: dedent`
it.each()("is not fine", async () => {expect.assertions();
expect(someValue).toBe(true);
});
`,
},
],
},
],
},
Expand All @@ -1580,6 +1678,28 @@ ruleTester.run('.each support', rule, {
messageId: 'haveExpectAssertions',
column: 3,
line: 2,
suggestions: [
{
messageId: 'suggestAddingHasAssertions',
output: dedent`
describe.each()('something', () => {
test.each()("is not fine", async () => {expect.hasAssertions();
expect(someValue).toBe(true);
});
});
`,
},
{
messageId: 'suggestAddingAssertions',
output: dedent`
describe.each()('something', () => {
test.each()("is not fine", async () => {expect.assertions();
expect(someValue).toBe(true);
});
});
`,
},
],
},
],
},
Expand Down
Loading