Skip to content

Commit 2776757

Browse files
committed
test: expect no output change with null
1 parent 5daaa0d commit 2776757

File tree

3 files changed

+13
-53
lines changed

3 files changed

+13
-53
lines changed

tests/lib/rules/await-async-events.test.ts

+9-35
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ ruleTester.run(RULE_NAME, rule, {
131131
doSomething()
132132
return fireEvent.${eventMethod}(getByLabelText('username'))
133133
}
134-
134+
135135
await triggerEvent()
136136
})
137137
`,
@@ -172,7 +172,7 @@ ruleTester.run(RULE_NAME, rule, {
172172
doSomething()
173173
return fireEvent.focus(getByLabelText('username'))
174174
}
175-
175+
176176
const reassignedFunction = triggerEvent
177177
})
178178
`,
@@ -318,7 +318,7 @@ ruleTester.run(RULE_NAME, rule, {
318318
doSomething()
319319
return userEvent.${eventMethod}(getByLabelText('username'))
320320
}
321-
321+
322322
await triggerEvent()
323323
})
324324
`,
@@ -380,7 +380,7 @@ ruleTester.run(RULE_NAME, rule, {
380380
doSomething()
381381
return userEvent.focus(getByLabelText('username'))
382382
}
383-
383+
384384
const reassignedFunction = triggerEvent
385385
})
386386
`,
@@ -447,11 +447,7 @@ ruleTester.run(RULE_NAME, rule, {
447447
},
448448
],
449449
options: [{ eventModule: 'fireEvent' }],
450-
output: `
451-
import { fireEvent } from '${testingFramework}'
452-
453-
fireEvent.${eventMethod}(getByLabelText('username'))
454-
`,
450+
output: null,
455451
}) as const
456452
),
457453
...FIRE_EVENT_ASYNC_FUNCTIONS.map(
@@ -759,16 +755,7 @@ ruleTester.run(RULE_NAME, rule, {
759755
},
760756
],
761757
options: [{ eventModule: 'fireEvent' }],
762-
output: `
763-
import { fireEvent } from '${testingFramework}'
764-
765-
function triggerEvent() {
766-
doSomething()
767-
return fireEvent.${eventMethod}(getByLabelText('username'))
768-
}
769-
770-
triggerEvent()
771-
`,
758+
output: null,
772759
}) as const
773760
),
774761
]),
@@ -805,7 +792,7 @@ ruleTester.run(RULE_NAME, rule, {
805792
({
806793
code: `
807794
import userEvent from '${testingFramework}'
808-
795+
809796
userEvent.${eventMethod}(getByLabelText('username'))
810797
`,
811798
errors: [
@@ -818,11 +805,7 @@ ruleTester.run(RULE_NAME, rule, {
818805
},
819806
],
820807
options: [{ eventModule: 'userEvent' }],
821-
output: `
822-
import userEvent from '${testingFramework}'
823-
824-
userEvent.${eventMethod}(getByLabelText('username'))
825-
`,
808+
output: null,
826809
}) as const
827810
),
828811
...USER_EVENT_ASYNC_FUNCTIONS.map(
@@ -974,16 +957,7 @@ ruleTester.run(RULE_NAME, rule, {
974957
},
975958
],
976959
options: [{ eventModule: 'userEvent' }],
977-
output: `
978-
import userEvent from '${testingFramework}'
979-
980-
function triggerEvent() {
981-
doSomething()
982-
return userEvent.${eventMethod}(getByLabelText('username'))
983-
}
984-
985-
triggerEvent()
986-
`,
960+
output: null,
987961
}) as const
988962
),
989963
...USER_EVENT_ASYNC_FUNCTIONS.map(

tests/lib/rules/no-dom-import.test.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ruleTester.run(RULE_NAME, rule, {
7777
messageId: 'noDomImport',
7878
},
7979
],
80-
output: 'import { fireEvent } from "dom-testing-library"',
80+
output: null,
8181
},
8282
{
8383
settings: {
@@ -92,9 +92,7 @@ ruleTester.run(RULE_NAME, rule, {
9292
messageId: 'noDomImport',
9393
},
9494
],
95-
output: `
96-
// case: dom-testing-library imported with custom module setting
97-
import { fireEvent } from "dom-testing-library"`,
95+
output: null,
9896
},
9997
...SUPPORTED_TESTING_FRAMEWORKS.flatMap(
10098
({ configOption, oldName, newName }) =>

tests/lib/rules/prefer-find-by.test.ts

+2-14
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,7 @@ ruleTester.run(RULE_NAME, rule, {
306306
},
307307
},
308308
],
309-
output: `
310-
import { waitFor, render} from '${testingFramework}';
311-
it('tests', async () => {
312-
const { getByCustomQuery } = render()
313-
const submitButton = await waitFor(() => getByCustomQuery('baz'))
314-
})
315-
`,
309+
output: null,
316310
},
317311
// custom query triggers the error but there is no fix - so output is the same
318312
{
@@ -333,13 +327,7 @@ ruleTester.run(RULE_NAME, rule, {
333327
},
334328
},
335329
],
336-
output: `
337-
import {waitFor,render,screen} from '${testingFramework}';
338-
it('tests', async () => {
339-
const { getByCustomQuery } = render()
340-
const submitButton = await waitFor(() => screen.getByCustomQuery('baz'))
341-
})
342-
`,
330+
output: null,
343331
},
344332
// presence matchers
345333
...createScenario((waitMethod: string, queryMethod: string) => ({

0 commit comments

Comments
 (0)