@@ -16,10 +16,10 @@ const ruleTester = createRuleTester();
16
16
17
17
const SUPPORTED_TESTING_FRAMEWORKS = [
18
18
'@testing-library/dom' ,
19
- '@testing-library/angular' ,
20
- '@testing-library/react' ,
21
- '@testing-library/vue' ,
22
- '@marko/testing-library' ,
19
+ // '@testing-library/angular',
20
+ // '@testing-library/react',
21
+ // '@testing-library/vue',
22
+ // '@marko/testing-library',
23
23
] ;
24
24
25
25
ruleTester . run ( RULE_NAME , rule , {
@@ -34,6 +34,22 @@ ruleTester.run(RULE_NAME, rule, {
34
34
await waitFor(function() {
35
35
expect(a).toEqual('a')
36
36
})
37
+ ` ,
38
+ } ,
39
+ {
40
+ code : `
41
+ await waitFor(function() {
42
+ expect(a).toEqual('a')
43
+ expect(b).toEqual('b')
44
+ })
45
+ ` ,
46
+ } ,
47
+ {
48
+ code : `
49
+ await waitFor(function() {
50
+ expect(a).toEqual('a')
51
+ expect('a').toEqual('a')
52
+ })
37
53
` ,
38
54
} ,
39
55
{
@@ -115,7 +131,18 @@ ruleTester.run(RULE_NAME, rule, {
115
131
code : `
116
132
await waitFor(() => {
117
133
expect(a).toEqual('a')
118
- expect(b).toEqual('b')
134
+ expect(a).toEqual('a')
135
+ })
136
+ ` ,
137
+ errors : [
138
+ { line : 4 , column : 11 , messageId : 'noWaitForMultipleAssertion' } ,
139
+ ] ,
140
+ } ,
141
+ {
142
+ code : `
143
+ await waitFor(() => {
144
+ expect(screen.getByTestId('a')).toHaveTextContent('a')
145
+ expect(screen.getByTestId('a')).toHaveTextContent('a')
119
146
})
120
147
` ,
121
148
errors : [
@@ -129,7 +156,7 @@ ruleTester.run(RULE_NAME, rule, {
129
156
import { waitFor } from '${ testingFramework } '
130
157
await waitFor(() => {
131
158
expect(a).toEqual('a')
132
- expect(b ).toEqual('b ')
159
+ expect(a ).toEqual('a ')
133
160
})
134
161
` ,
135
162
errors : [
@@ -143,7 +170,7 @@ ruleTester.run(RULE_NAME, rule, {
143
170
import { waitFor as renamedWaitFor } from 'test-utils'
144
171
await renamedWaitFor(() => {
145
172
expect(a).toEqual('a')
146
- expect(b ).toEqual('b ')
173
+ expect(a ).toEqual('a ')
147
174
})
148
175
` ,
149
176
errors : [
@@ -155,7 +182,7 @@ ruleTester.run(RULE_NAME, rule, {
155
182
await waitFor(() => {
156
183
expect(a).toEqual('a')
157
184
console.log('testing-library')
158
- expect(b ).toEqual('b ')
185
+ expect(a ).toEqual('a ')
159
186
})
160
187
` ,
161
188
errors : [
@@ -168,7 +195,7 @@ ruleTester.run(RULE_NAME, rule, {
168
195
await waitFor(() => {
169
196
expect(a).toEqual('a')
170
197
console.log('testing-library')
171
- expect(b ).toEqual('b ')
198
+ expect(a ).toEqual('a ')
172
199
})
173
200
})
174
201
` ,
@@ -181,7 +208,7 @@ ruleTester.run(RULE_NAME, rule, {
181
208
await waitFor(async () => {
182
209
expect(a).toEqual('a')
183
210
await somethingAsync()
184
- expect(b ).toEqual('b ')
211
+ expect(a ).toEqual('a ')
185
212
})
186
213
` ,
187
214
errors : [
@@ -192,9 +219,9 @@ ruleTester.run(RULE_NAME, rule, {
192
219
code : `
193
220
await waitFor(function() {
194
221
expect(a).toEqual('a')
195
- expect(b ).toEqual('b ')
196
- expect(c ).toEqual('c ')
197
- expect(d ).toEqual('d ')
222
+ expect(a ).toEqual('a ')
223
+ expect(a ).toEqual('a ')
224
+ expect(a ).toEqual('a ')
198
225
})
199
226
` ,
200
227
errors : [
@@ -207,8 +234,22 @@ ruleTester.run(RULE_NAME, rule, {
207
234
code : `
208
235
await waitFor(function() {
209
236
expect(a).toEqual('a')
210
- console.log('testing-library ')
237
+ expect(a).toEqual('a ')
211
238
expect(b).toEqual('b')
239
+ expect(b).toEqual('b')
240
+ })
241
+ ` ,
242
+ errors : [
243
+ { line : 4 , column : 11 , messageId : 'noWaitForMultipleAssertion' } ,
244
+ { line : 6 , column : 11 , messageId : 'noWaitForMultipleAssertion' } ,
245
+ ] ,
246
+ } ,
247
+ {
248
+ code : `
249
+ await waitFor(function() {
250
+ expect(a).toEqual('a')
251
+ console.log('testing-library')
252
+ expect(a).toEqual('a')
212
253
})
213
254
` ,
214
255
errors : [
@@ -220,8 +261,20 @@ ruleTester.run(RULE_NAME, rule, {
220
261
await waitFor(async function() {
221
262
expect(a).toEqual('a')
222
263
const el = await somethingAsync()
223
- expect(b ).toEqual('b ')
264
+ expect(a ).toEqual('a ')
224
265
})
266
+ ` ,
267
+ errors : [
268
+ { line : 5 , column : 11 , messageId : 'noWaitForMultipleAssertion' } ,
269
+ ] ,
270
+ } ,
271
+ {
272
+ code : `
273
+ await waitFor(() => {
274
+ expect(window.fetch).toHaveBeenCalledTimes(1);
275
+ expect(localStorage.setItem).toHaveBeenCalledWith('bar', 'baz');
276
+ expect(window.fetch).toHaveBeenCalledWith('/foo');
277
+ });
225
278
` ,
226
279
errors : [
227
280
{ line : 5 , column : 11 , messageId : 'noWaitForMultipleAssertion' } ,
0 commit comments