@@ -45,6 +45,11 @@ ruleTester.run('prefer-to-be', rule, {
45
45
output : 'expect(value).toBe(`my string`);' ,
46
46
errors : [ { messageId : 'useToBe' , column : 15 , line : 1 } ] ,
47
47
} ,
48
+ {
49
+ code : 'expect(value)["toEqual"](`my string`);' ,
50
+ output : "expect(value)['toBe'](`my string`);" ,
51
+ errors : [ { messageId : 'useToBe' , column : 15 , line : 1 } ] ,
52
+ } ,
48
53
{
49
54
code : 'expect(value).toStrictEqual(`my ${string}`);' ,
50
55
output : 'expect(value).toBe(`my ${string}`);' ,
@@ -55,6 +60,16 @@ ruleTester.run('prefer-to-be', rule, {
55
60
output : 'expect(loadMessage()).resolves.toBe("hello world");' ,
56
61
errors : [ { messageId : 'useToBe' , column : 32 , line : 1 } ] ,
57
62
} ,
63
+ {
64
+ code : 'expect(loadMessage()).resolves["toStrictEqual"]("hello world");' ,
65
+ output : 'expect(loadMessage()).resolves[\'toBe\']("hello world");' ,
66
+ errors : [ { messageId : 'useToBe' , column : 32 , line : 1 } ] ,
67
+ } ,
68
+ {
69
+ code : 'expect(loadMessage())["resolves"].toStrictEqual("hello world");' ,
70
+ output : 'expect(loadMessage())["resolves"].toBe("hello world");' ,
71
+ errors : [ { messageId : 'useToBe' , column : 35 , line : 1 } ] ,
72
+ } ,
58
73
{
59
74
code : 'expect(loadMessage()).resolves.toStrictEqual(false);' ,
60
75
output : 'expect(loadMessage()).resolves.toBe(false);' ,
@@ -103,6 +118,16 @@ ruleTester.run('prefer-to-be: null', rule, {
103
118
output : 'expect("a string").not.toBeNull();' ,
104
119
errors : [ { messageId : 'useToBeNull' , column : 24 , line : 1 } ] ,
105
120
} ,
121
+ {
122
+ code : 'expect("a string").not["toBe"](null);' ,
123
+ output : 'expect("a string").not[\'toBeNull\']();' ,
124
+ errors : [ { messageId : 'useToBeNull' , column : 24 , line : 1 } ] ,
125
+ } ,
126
+ {
127
+ code : 'expect("a string")["not"]["toBe"](null);' ,
128
+ output : 'expect("a string")["not"][\'toBeNull\']();' ,
129
+ errors : [ { messageId : 'useToBeNull' , column : 27 , line : 1 } ] ,
130
+ } ,
106
131
{
107
132
code : 'expect("a string").not.toEqual(null);' ,
108
133
output : 'expect("a string").not.toBeNull();' ,
@@ -156,6 +181,11 @@ ruleTester.run('prefer-to-be: undefined', rule, {
156
181
output : 'expect("a string").rejects.toBeDefined();' ,
157
182
errors : [ { messageId : 'useToBeDefined' , column : 32 , line : 1 } ] ,
158
183
} ,
184
+ {
185
+ code : 'expect("a string").rejects.not["toBe"](undefined);' ,
186
+ output : 'expect("a string").rejects[\'toBeDefined\']();' ,
187
+ errors : [ { messageId : 'useToBeDefined' , column : 32 , line : 1 } ] ,
188
+ } ,
159
189
{
160
190
code : 'expect("a string").not.toEqual(undefined);' ,
161
191
output : 'expect("a string").toBeDefined();' ,
@@ -208,6 +238,11 @@ ruleTester.run('prefer-to-be: NaN', rule, {
208
238
output : 'expect("a string").rejects.not.toBeNaN();' ,
209
239
errors : [ { messageId : 'useToBeNaN' , column : 32 , line : 1 } ] ,
210
240
} ,
241
+ {
242
+ code : 'expect("a string")["rejects"].not.toBe(NaN);' ,
243
+ output : 'expect("a string")["rejects"].not.toBeNaN();' ,
244
+ errors : [ { messageId : 'useToBeNaN' , column : 35 , line : 1 } ] ,
245
+ } ,
211
246
{
212
247
code : 'expect("a string").not.toEqual(NaN);' ,
213
248
output : 'expect("a string").not.toBeNaN();' ,
0 commit comments