@@ -55,8 +55,9 @@ const ast = compile(css);
55
55
56
56
describe ( 'lookup' , ( ) => {
57
57
test ( 'is a function' , ( ) => {
58
- expect . assertions ( 1 ) ;
59
- expect ( lookup ) . toBeInstanceOf ( Function ) ;
58
+ expect . assertions ( 2 ) ;
59
+ expect ( lookup ) . toBeFunction ( ) ;
60
+ expect ( lookup ) . not . toBeClass ( ) ;
60
61
} ) ;
61
62
62
63
test ( 'expects 2 parameters' , ( ) => {
@@ -111,8 +112,9 @@ describe('lookup', () => {
111
112
112
113
describe ( 'walk' , ( ) => {
113
114
test ( 'is a function' , ( ) => {
114
- expect . assertions ( 1 ) ;
115
- expect ( walk ) . toBeInstanceOf ( Function ) ;
115
+ expect . assertions ( 2 ) ;
116
+ expect ( walk ) . toBeFunction ( ) ;
117
+ expect ( walk ) . not . toBeClass ( ) ;
116
118
} ) ;
117
119
118
120
test ( 'expects 2 parameters' , ( ) => {
@@ -122,6 +124,7 @@ describe('walk', () => {
122
124
123
125
test ( 'has no return value' , ( ) => {
124
126
expect . assertions ( 1 ) ;
127
+ // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
125
128
expect ( walk ( ast , ( ) => { } ) ) . toBeUndefined ( ) ;
126
129
} ) ;
127
130
@@ -146,8 +149,9 @@ describe('walk', () => {
146
149
147
150
describe ( 'reduce' , ( ) => {
148
151
test ( 'is a function' , ( ) => {
149
- expect . assertions ( 1 ) ;
150
- expect ( reduce ) . toBeInstanceOf ( Function ) ;
152
+ expect . assertions ( 2 ) ;
153
+ expect ( reduce ) . toBeFunction ( ) ;
154
+ expect ( reduce ) . not . toBeClass ( ) ;
151
155
} ) ;
152
156
153
157
test ( 'expects 1 parameter' , ( ) => {
@@ -161,11 +165,12 @@ describe('reduce', () => {
161
165
expect ( reduced ) . toBePlainObject ( ) ;
162
166
} ) ;
163
167
164
- test ( 'throws when passed undefined' , ( ) => {
165
- expect . assertions ( 1 ) ;
168
+ test ( 'throws when passed null or undefined' , ( ) => {
169
+ expect . assertions ( 2 ) ;
170
+ // @ts -expect-error - intentionally passing wrong type
171
+ expect ( ( ) => reduce ( null ) ) . toThrow ( ) ;
166
172
// @ts -expect-error - intentionally passing wrong type
167
- // eslint-disable-next-line unicorn/no-useless-undefined
168
- expect ( ( ) => reduce ( undefined ) ) . toThrow ( ) ;
173
+ expect ( ( ) => reduce ( ) ) . toThrow ( ) ;
169
174
} ) ;
170
175
171
176
test ( 'merges all elements, overriding earlier values' , ( ) => {
@@ -181,8 +186,9 @@ describe('reduce', () => {
181
186
182
187
describe ( 'cleanElement' , ( ) => {
183
188
test ( 'is a function' , ( ) => {
184
- expect . assertions ( 1 ) ;
185
- expect ( cleanElement ) . toBeInstanceOf ( Function ) ;
189
+ expect . assertions ( 2 ) ;
190
+ expect ( cleanElement ) . toBeFunction ( ) ;
191
+ expect ( cleanElement ) . not . toBeClass ( ) ;
186
192
} ) ;
187
193
188
194
test ( 'expects 1 parameter' , ( ) => {
@@ -257,8 +263,9 @@ const notHexColors = [
257
263
258
264
describe ( 'isHexColor' , ( ) => {
259
265
test ( 'is a function' , ( ) => {
260
- expect . assertions ( 1 ) ;
261
- expect ( isHexColor ) . toBeInstanceOf ( Function ) ;
266
+ expect . assertions ( 2 ) ;
267
+ expect ( isHexColor ) . toBeFunction ( ) ;
268
+ expect ( isHexColor ) . not . toBeClass ( ) ;
262
269
} ) ;
263
270
264
271
test ( 'expects 1 parameter' , ( ) => {
@@ -284,8 +291,9 @@ describe('isHexColor', () => {
284
291
285
292
describe ( 'hexToRgb' , ( ) => {
286
293
test ( 'is a function' , ( ) => {
287
- expect . assertions ( 1 ) ;
288
- expect ( hexToRgb ) . toBeInstanceOf ( Function ) ;
294
+ expect . assertions ( 2 ) ;
295
+ expect ( hexToRgb ) . toBeFunction ( ) ;
296
+ expect ( hexToRgb ) . not . toBeClass ( ) ;
289
297
} ) ;
290
298
291
299
test ( 'expects 1 parameter' , ( ) => {
@@ -301,8 +309,9 @@ describe('hexToRgb', () => {
301
309
302
310
describe ( 'linearize' , ( ) => {
303
311
test ( 'is a function' , ( ) => {
304
- expect . assertions ( 1 ) ;
305
- expect ( linearize ) . toBeInstanceOf ( Function ) ;
312
+ expect . assertions ( 2 ) ;
313
+ expect ( linearize ) . toBeFunction ( ) ;
314
+ expect ( linearize ) . not . toBeClass ( ) ;
306
315
} ) ;
307
316
308
317
test ( 'expects 1 parameter' , ( ) => {
@@ -318,8 +327,9 @@ describe('linearize', () => {
318
327
319
328
describe ( 'luminance' , ( ) => {
320
329
test ( 'is a function' , ( ) => {
321
- expect . assertions ( 1 ) ;
322
- expect ( luminance ) . toBeInstanceOf ( Function ) ;
330
+ expect . assertions ( 2 ) ;
331
+ expect ( luminance ) . toBeFunction ( ) ;
332
+ expect ( luminance ) . not . toBeClass ( ) ;
323
333
} ) ;
324
334
325
335
test ( 'expects 1 parameter' , ( ) => {
@@ -335,8 +345,9 @@ describe('luminance', () => {
335
345
336
346
describe ( 'isLightOrDark' , ( ) => {
337
347
test ( 'is a function' , ( ) => {
338
- expect . assertions ( 1 ) ;
339
- expect ( isLightOrDark ) . toBeInstanceOf ( Function ) ;
348
+ expect . assertions ( 2 ) ;
349
+ expect ( isLightOrDark ) . toBeFunction ( ) ;
350
+ expect ( isLightOrDark ) . not . toBeClass ( ) ;
340
351
} ) ;
341
352
342
353
test ( 'expects 1 parameter' , ( ) => {
0 commit comments