Skip to content

Commit 5640b0d

Browse files
committed
test: update tests
1 parent fa85582 commit 5640b0d

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

tests/lib/rules/no-node-access.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,16 @@ ruleTester.run(RULE_NAME, rule, {
227227
228228
const buttonText = screen.getByText('submit');
229229
fe.click(buttonText);
230+
`,
231+
},
232+
{
233+
settings: { 'testing-library/utils-module': 'test-utils' },
234+
code: `
235+
// case: custom module set but not imported using ${testingFramework} (aggressive reporting limited)
236+
import { screen, fireEvent } from '../test-utils';
237+
238+
const buttonText = screen.getByText('submit');
239+
fireEvent.click(buttonText);
230240
`,
231241
},
232242
{

tests/lib/utils/resolve-to-testing-library-fn.test.ts

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ ruleTester.run('esm', rule, {
8080
userEvent.default.setup()
8181
`,
8282
},
83-
{
84-
// Verifies that a local './test-utils' import doesn't match the configured 'test-utils' utils module
85-
settings: { 'testing-library/utils-module': 'test-utils' },
86-
code: `
87-
import { userEvent } from './test-utils';
88-
89-
userEvent.setup()
90-
`,
91-
},
9283
...LIBRARY_MODULES.map((module) => ({
9384
code: `
9485
import * as testingLibrary from '${module}';
@@ -172,6 +163,44 @@ ruleTester.run('esm', rule, {
172163
},
173164
],
174165
},
166+
{
167+
settings: { 'testing-library/utils-module': 'test-utils' },
168+
code: `
169+
import userEvent from '../test-utils';
170+
171+
userEvent.setup()
172+
`,
173+
errors: [
174+
{
175+
messageId: 'details',
176+
data: {
177+
data: {
178+
original: null,
179+
local: 'userEvent',
180+
},
181+
},
182+
},
183+
],
184+
},
185+
{
186+
settings: { 'testing-library/utils-module': 'test-utils' },
187+
code: `
188+
import userEvent from '@/test-utils';
189+
190+
userEvent.setup()
191+
`,
192+
errors: [
193+
{
194+
messageId: 'details',
195+
data: {
196+
data: {
197+
original: null,
198+
local: 'userEvent',
199+
},
200+
},
201+
},
202+
],
203+
},
175204
{
176205
settings: {
177206
'testing-library/custom-renders': ['customRender', 'renderWithRedux'],

0 commit comments

Comments
 (0)