@@ -142,6 +142,10 @@ ruleTester.run(RULE_NAME, rule, {
142142 column : 31 ,
143143 } ,
144144 ] ,
145+ output : `async () => {
146+ const element = ${ query } ('foo')
147+ }
148+ ` ,
145149 } as const )
146150 ) ,
147151 // custom sync queries with await operator are not valid
@@ -152,6 +156,11 @@ ruleTester.run(RULE_NAME, rule, {
152156 }
153157 ` ,
154158 errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 31 } ] ,
159+ output : `
160+ async () => {
161+ const element = getByIcon('search')
162+ }
163+ ` ,
155164 } ,
156165 {
157166 code : `
@@ -160,6 +169,11 @@ ruleTester.run(RULE_NAME, rule, {
160169 }
161170 ` ,
162171 errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 31 } ] ,
172+ output : `
173+ async () => {
174+ const element = queryByIcon('search')
175+ }
176+ ` ,
163177 } ,
164178 {
165179 code : `
@@ -168,6 +182,11 @@ ruleTester.run(RULE_NAME, rule, {
168182 }
169183 ` ,
170184 errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 38 } ] ,
185+ output : `
186+ async () => {
187+ const element = screen.getAllByIcon('search')
188+ }
189+ ` ,
171190 } ,
172191 {
173192 code : `
@@ -176,6 +195,11 @@ ruleTester.run(RULE_NAME, rule, {
176195 }
177196 ` ,
178197 errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 38 } ] ,
198+ output : `
199+ async () => {
200+ const element = screen.queryAllByIcon('search')
201+ }
202+ ` ,
179203 } ,
180204 // sync queries with await operator inside assert are not valid
181205 ...SYNC_QUERIES_COMBINATIONS . map (
@@ -192,6 +216,10 @@ ruleTester.run(RULE_NAME, rule, {
192216 column : 22 ,
193217 } ,
194218 ] ,
219+ output : `async () => {
220+ expect(${ query } ('foo')).toBeEnabled()
221+ }
222+ ` ,
195223 } as const )
196224 ) ,
197225
@@ -210,6 +238,10 @@ ruleTester.run(RULE_NAME, rule, {
210238 column : 38 ,
211239 } ,
212240 ] ,
241+ output : `async () => {
242+ const element = screen.${ query } ('foo')
243+ }
244+ ` ,
213245 } as const )
214246 ) ,
215247
@@ -228,6 +260,10 @@ ruleTester.run(RULE_NAME, rule, {
228260 column : 29 ,
229261 } ,
230262 ] ,
263+ output : `async () => {
264+ expect(screen.${ query } ('foo')).toBeEnabled()
265+ }
266+ ` ,
231267 } as const )
232268 ) ,
233269
@@ -244,6 +280,12 @@ ruleTester.run(RULE_NAME, rule, {
244280 }
245281 ` ,
246282 errors : [ { messageId : 'noAwaitSyncQuery' , line : 4 , column : 38 } ] ,
283+ output : `
284+ import { screen } from '${ testingFramework } '
285+ () => {
286+ const element = screen.getByRole('button')
287+ }
288+ ` ,
247289 } as const )
248290 ) ,
249291 // sync query awaited and related to custom module is not valid
@@ -256,6 +298,12 @@ ruleTester.run(RULE_NAME, rule, {
256298 }
257299 ` ,
258300 errors : [ { messageId : 'noAwaitSyncQuery' , line : 4 , column : 38 } ] ,
301+ output : `
302+ import { screen } from 'test-utils'
303+ () => {
304+ const element = screen.getByRole('button')
305+ }
306+ ` ,
259307 } ,
260308
261309 // awaited custom sync query matching custom-queries setting is invalid
@@ -269,6 +317,11 @@ ruleTester.run(RULE_NAME, rule, {
269317 })
270318 ` ,
271319 errors : [ { messageId : 'noAwaitSyncQuery' , line : 3 , column : 31 } ] ,
320+ output : `
321+ test('A valid example test', async () => {
322+ const element = queryByIcon('search')
323+ })
324+ ` ,
272325 } ,
273326 ] ,
274327} ) ;
0 commit comments