@@ -142,6 +142,10 @@ ruleTester.run(RULE_NAME, rule, {
142
142
column : 31 ,
143
143
} ,
144
144
] ,
145
+ output : `async () => {
146
+ const element = ${ query } ('foo')
147
+ }
148
+ ` ,
145
149
} as const )
146
150
) ,
147
151
// custom sync queries with await operator are not valid
@@ -152,6 +156,11 @@ ruleTester.run(RULE_NAME, rule, {
152
156
}
153
157
` ,
154
158
errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 31 } ] ,
159
+ output : `
160
+ async () => {
161
+ const element = getByIcon('search')
162
+ }
163
+ ` ,
155
164
} ,
156
165
{
157
166
code : `
@@ -160,6 +169,11 @@ ruleTester.run(RULE_NAME, rule, {
160
169
}
161
170
` ,
162
171
errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 31 } ] ,
172
+ output : `
173
+ async () => {
174
+ const element = queryByIcon('search')
175
+ }
176
+ ` ,
163
177
} ,
164
178
{
165
179
code : `
@@ -168,6 +182,11 @@ ruleTester.run(RULE_NAME, rule, {
168
182
}
169
183
` ,
170
184
errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 38 } ] ,
185
+ output : `
186
+ async () => {
187
+ const element = screen.getAllByIcon('search')
188
+ }
189
+ ` ,
171
190
} ,
172
191
{
173
192
code : `
@@ -176,6 +195,11 @@ ruleTester.run(RULE_NAME, rule, {
176
195
}
177
196
` ,
178
197
errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 38 } ] ,
198
+ output : `
199
+ async () => {
200
+ const element = screen.queryAllByIcon('search')
201
+ }
202
+ ` ,
179
203
} ,
180
204
// sync queries with await operator inside assert are not valid
181
205
...SYNC_QUERIES_COMBINATIONS . map (
@@ -192,6 +216,10 @@ ruleTester.run(RULE_NAME, rule, {
192
216
column : 22 ,
193
217
} ,
194
218
] ,
219
+ output : `async () => {
220
+ expect(${ query } ('foo')).toBeEnabled()
221
+ }
222
+ ` ,
195
223
} as const )
196
224
) ,
197
225
@@ -210,6 +238,10 @@ ruleTester.run(RULE_NAME, rule, {
210
238
column : 38 ,
211
239
} ,
212
240
] ,
241
+ output : `async () => {
242
+ const element = screen.${ query } ('foo')
243
+ }
244
+ ` ,
213
245
} as const )
214
246
) ,
215
247
@@ -228,6 +260,10 @@ ruleTester.run(RULE_NAME, rule, {
228
260
column : 29 ,
229
261
} ,
230
262
] ,
263
+ output : `async () => {
264
+ expect(screen.${ query } ('foo')).toBeEnabled()
265
+ }
266
+ ` ,
231
267
} as const )
232
268
) ,
233
269
@@ -244,6 +280,12 @@ ruleTester.run(RULE_NAME, rule, {
244
280
}
245
281
` ,
246
282
errors : [ { messageId : 'noAwaitSyncQuery' , line : 4 , column : 38 } ] ,
283
+ output : `
284
+ import { screen } from '${ testingFramework } '
285
+ () => {
286
+ const element = screen.getByRole('button')
287
+ }
288
+ ` ,
247
289
} as const )
248
290
) ,
249
291
// sync query awaited and related to custom module is not valid
@@ -256,6 +298,12 @@ ruleTester.run(RULE_NAME, rule, {
256
298
}
257
299
` ,
258
300
errors : [ { messageId : 'noAwaitSyncQuery' , line : 4 , column : 38 } ] ,
301
+ output : `
302
+ import { screen } from 'test-utils'
303
+ () => {
304
+ const element = screen.getByRole('button')
305
+ }
306
+ ` ,
259
307
} ,
260
308
261
309
// awaited custom sync query matching custom-queries setting is invalid
@@ -269,6 +317,11 @@ ruleTester.run(RULE_NAME, rule, {
269
317
})
270
318
` ,
271
319
errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 31 } ] ,
320
+ output : `
321
+ test('A valid example test', async () => {
322
+ const element = queryByIcon('search')
323
+ })
324
+ ` ,
272
325
} ,
273
326
] ,
274
327
} ) ;
0 commit comments