@@ -151,6 +151,14 @@ ruleTester.run('logical conditions', rule, {
151
151
` ,
152
152
errors : [ { messageId : 'conditionalExpect' } ] ,
153
153
} ,
154
+ {
155
+ code : `
156
+ it.each()('foo', () => {
157
+ something || expect(something).toHaveBeenCalled();
158
+ })
159
+ ` ,
160
+ errors : [ { messageId : 'conditionalExpect' } ] ,
161
+ } ,
154
162
{
155
163
code : `
156
164
function getValue() {
@@ -218,6 +226,14 @@ ruleTester.run('conditional conditions', rule, {
218
226
` ,
219
227
errors : [ { messageId : 'conditionalExpect' } ] ,
220
228
} ,
229
+ {
230
+ code : `
231
+ it.each()('foo', () => {
232
+ something ? noop() : expect(something).toHaveBeenCalled();
233
+ })
234
+ ` ,
235
+ errors : [ { messageId : 'conditionalExpect' } ] ,
236
+ } ,
221
237
{
222
238
code : `
223
239
function getValue() {
@@ -304,6 +320,19 @@ ruleTester.run('switch conditions', rule, {
304
320
` ,
305
321
errors : [ { messageId : 'conditionalExpect' } ] ,
306
322
} ,
323
+ {
324
+ code : `
325
+ it.each()('foo', () => {
326
+ switch(something) {
327
+ case 'value':
328
+ expect(something).toHaveBeenCalled();
329
+ default:
330
+ break;
331
+ }
332
+ })
333
+ ` ,
334
+ errors : [ { messageId : 'conditionalExpect' } ] ,
335
+ } ,
307
336
{
308
337
code : `
309
338
function getValue() {
@@ -384,6 +413,18 @@ ruleTester.run('if conditions', rule, {
384
413
` ,
385
414
errors : [ { messageId : 'conditionalExpect' } ] ,
386
415
} ,
416
+ {
417
+ code : `
418
+ it.each()('foo', () => {
419
+ if(!doSomething) {
420
+ // do nothing
421
+ } else {
422
+ expect(something).toHaveBeenCalled();
423
+ }
424
+ })
425
+ ` ,
426
+ errors : [ { messageId : 'conditionalExpect' } ] ,
427
+ } ,
387
428
{
388
429
code : `
389
430
function getValue() {
@@ -491,6 +532,18 @@ ruleTester.run('catch conditions', rule, {
491
532
` ,
492
533
errors : [ { messageId : 'conditionalExpect' } ] ,
493
534
} ,
535
+ {
536
+ code : `
537
+ it.each()('foo', () => {
538
+ try {
539
+
540
+ } catch (err) {
541
+ expect(err).toMatch('Error');
542
+ }
543
+ })
544
+ ` ,
545
+ errors : [ { messageId : 'conditionalExpect' } ] ,
546
+ } ,
494
547
{
495
548
code : `
496
549
it.skip.each\`\`('foo', () => {
@@ -503,6 +556,18 @@ ruleTester.run('catch conditions', rule, {
503
556
` ,
504
557
errors : [ { messageId : 'conditionalExpect' } ] ,
505
558
} ,
559
+ {
560
+ code : `
561
+ it.skip.each()('foo', () => {
562
+ try {
563
+
564
+ } catch (err) {
565
+ expect(err).toMatch('Error');
566
+ }
567
+ })
568
+ ` ,
569
+ errors : [ { messageId : 'conditionalExpect' } ] ,
570
+ } ,
506
571
{
507
572
code : `
508
573
function getValue() {
0 commit comments