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: remove duplicate cases #927

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion tests/create-testing-library-rule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ ruleTester.run(RULE_NAME, rule, {

// cases: weird scenarios to check guard against parent nodes
'expect(element).not()',
'expect(element).not()',

// Test Cases for Queries and Aggressive Queries Reporting
{
Expand Down
45 changes: 0 additions & 45 deletions tests/lib/rules/no-await-sync-events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,51 +289,6 @@ ruleTester.run(RULE_NAME, rule, {
} as const)
),

// sync fireEvent methods with await operator are not valid
// when only fire-event set in eventModules
...SUPPORTED_TESTING_FRAMEWORKS.flatMap((testingFramework) =>
FIRE_EVENT_FUNCTIONS.map(
(func) =>
({
code: `
import { fireEvent } from '${testingFramework}';
test('should report fireEvent.${func} sync event awaited', async() => {
await fireEvent.${func}('foo');
});
`,
errors: [
{
line: 4,
column: 17,
messageId: 'noAwaitSyncEvents',
data: { name: `fireEvent.${func}` },
},
],
} as const)
)
),

...USER_EVENT_SYNC_FUNCTIONS.map(
(func) =>
({
code: `
import userEvent from '@testing-library/user-event';
test('should report userEvent.${func} sync event awaited', async() => {
await userEvent.${func}('foo');
});
`,
options: [{ eventModules: ['user-event'] }],
errors: [
{
line: 4,
column: 17,
messageId: 'noAwaitSyncEvents',
data: { name: `userEvent.${func}` },
},
],
} as const)
),

{
code: `
import userEvent from '@testing-library/user-event';
Expand Down
39 changes: 0 additions & 39 deletions tests/lib/rules/no-debugging-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,6 @@ ruleTester.run(RULE_NAME, rule, {
code: `
import { screen } from '@testing-library/dom'
screen.debug()
`,
errors: [
{
line: 3,
column: 16,
messageId: 'noDebug',
},
],
},
{
code: `
import { screen } from '@testing-library/dom'
screen.logTestingPlaygroundURL()
`,
errors: [
{
Expand Down Expand Up @@ -486,19 +473,6 @@ ruleTester.run(RULE_NAME, rule, {
code: `
import { screen } from '@testing-library/dom'
screen.logTestingPlaygroundURL()
`,
errors: [
{
line: 3,
column: 16,
messageId: 'noDebug',
},
],
},
{
code: `
import { screen } from '@testing-library/dom'
screen.logTestingPlaygroundURL()
`,
options: [{ utilsToCheckFor: {} }],
errors: [
Expand All @@ -509,19 +483,6 @@ ruleTester.run(RULE_NAME, rule, {
},
],
},
{
code: `
import { screen } from '@testing-library/dom'
screen.logTestingPlaygroundURL()
`,
errors: [
{
line: 3,
column: 16,
messageId: 'noDebug',
},
],
},
{
settings: { 'testing-library/utils-module': 'test-utils' },
code: `// aggressive reporting disabled
Expand Down
18 changes: 0 additions & 18 deletions tests/lib/rules/no-wait-for-side-effects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,6 @@ ruleTester.run(RULE_NAME, rule, {
settings: { 'testing-library/custom-renders': ['renderHelper'] },
code: `
import { waitFor } from '${testingFramework}';
import { renderWrapper } from 'somewhere-else';
await waitFor(() => {
renderWrapper(<App />)
})
`,
},
{
settings: { 'testing-library/custom-renders': ['renderHelper'] },
code: `
import { waitFor } from '${testingFramework}';
await waitFor(() => result = renderWrapper(<App />))
`,
},
Expand Down Expand Up @@ -432,14 +422,6 @@ ruleTester.run(RULE_NAME, rule, {
{
code: `
import { waitFor } from '${testingFramework}';
const { rerender } = render(<App />)
await waitFor(() => rerender(<App />))
`,
errors: [{ line: 4, column: 29, messageId: 'noSideEffectsWaitFor' }],
} as const,
{
code: `
import { waitFor } from '${testingFramework}';
await waitFor(() => renderHelper(<App />))
`,
errors: [{ line: 3, column: 29, messageId: 'noSideEffectsWaitFor' }],
Expand Down
8 changes: 0 additions & 8 deletions tests/lib/rules/prefer-explicit-assert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,6 @@ ruleTester.run(RULE_NAME, rule, {
],
} as const)
),
{
code: `getByIcon('foo')`, // custom `getBy` query extended through options
errors: [
{
messageId: 'preferExplicitAssert',
},
],
},
...COMBINED_QUERIES_METHODS.map(
(queryMethod) =>
({
Expand Down
14 changes: 0 additions & 14 deletions tests/lib/rules/prefer-query-by-disappearance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,6 @@ ruleTester.run(RULE_NAME, rule, {
code: `
import { screen, waitForElementToBeRemoved } from '${testingFramework}';

await waitForElementToBeRemoved(() => screen.getByText("hello"))
`,
errors: [
{
messageId: 'preferQueryByDisappearance',
line: 4,
column: 54,
},
],
},
{
code: `
import { screen, waitForElementToBeRemoved } from '@marko/testing-library';

await waitForElementToBeRemoved(() => screen.getByText("hello"))
`,
errors: [
Expand Down
20 changes: 0 additions & 20 deletions tests/lib/rules/prefer-screen-queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,26 +278,6 @@ ruleTester.run(RULE_NAME, rule, {
} as const)
)
),
...ALL_QUERIES_COMBINATIONS.map(
(queryMethod) =>
({
settings: { 'testing-library/utils-module': 'test-utils' },
code: `
import { render } from 'test-utils'
const { ${queryMethod} } = render(foo)
${queryMethod}()`,
errors: [
{
line: 4,
column: 9,
messageId: 'preferScreenQueries',
data: {
name: queryMethod,
},
},
],
} as const)
),
...ALL_QUERIES_COMBINATIONS.map(
(queryMethod) =>
({
Expand Down