@@ -72,6 +72,26 @@ ruleTester.run('prefer-to-contain', rule, {
7272 errors : [ { messageId : 'useToContain' , column : 23 , line : 1 } ] ,
7373 output : 'expect(a).not.toContain(b);' ,
7474 } ,
75+ {
76+ code : 'expect(a.includes(b)).toStrictEqual(true);' ,
77+ errors : [ { messageId : 'useToContain' , column : 23 , line : 1 } ] ,
78+ output : 'expect(a).toContain(b);' ,
79+ } ,
80+ {
81+ code : 'expect(a.includes(b)).toStrictEqual(false);' ,
82+ errors : [ { messageId : 'useToContain' , column : 23 , line : 1 } ] ,
83+ output : 'expect(a).not.toContain(b);' ,
84+ } ,
85+ {
86+ code : 'expect(a.includes(b)).not.toStrictEqual(false);' ,
87+ errors : [ { messageId : 'useToContain' , column : 23 , line : 1 } ] ,
88+ output : 'expect(a).toContain(b);' ,
89+ } ,
90+ {
91+ code : 'expect(a.includes(b)).not.toStrictEqual(true);' ,
92+ errors : [ { messageId : 'useToContain' , column : 23 , line : 1 } ] ,
93+ output : 'expect(a).not.toContain(b);' ,
94+ } ,
7595 {
7696 code : 'expect(a.test(t).includes(b.test(p))).toEqual(true);' ,
7797 errors : [ { messageId : 'useToContain' , column : 39 , line : 1 } ] ,
@@ -112,6 +132,26 @@ ruleTester.run('prefer-to-contain', rule, {
112132 errors : [ { messageId : 'useToContain' , column : 33 , line : 1 } ] ,
113133 output : 'expect([{a:1}]).toContain({a:1});' ,
114134 } ,
135+ {
136+ code : 'expect([{a:1}].includes({a:1})).toStrictEqual(true);' ,
137+ errors : [ { messageId : 'useToContain' , column : 33 , line : 1 } ] ,
138+ output : 'expect([{a:1}]).toContain({a:1});' ,
139+ } ,
140+ {
141+ code : 'expect([{a:1}].includes({a:1})).toStrictEqual(false);' ,
142+ errors : [ { messageId : 'useToContain' , column : 33 , line : 1 } ] ,
143+ output : 'expect([{a:1}]).not.toContain({a:1});' ,
144+ } ,
145+ {
146+ code : 'expect([{a:1}].includes({a:1})).not.toStrictEqual(true);' ,
147+ errors : [ { messageId : 'useToContain' , column : 33 , line : 1 } ] ,
148+ output : 'expect([{a:1}]).not.toContain({a:1});' ,
149+ } ,
150+ {
151+ code : 'expect([{a:1}].includes({a:1})).not.toStrictEqual(false);' ,
152+ errors : [ { messageId : 'useToContain' , column : 33 , line : 1 } ] ,
153+ output : 'expect([{a:1}]).toContain({a:1});' ,
154+ } ,
115155 ] ,
116156} ) ;
117157
0 commit comments