1
- import { deepEquals } from '../src' ;
1
+ import { deepEquals , sameArrayItems , shallowArrayEquals , strictEquals } from '../src' ;
2
2
3
3
describe ( 'equals' , ( ) => {
4
4
test ( 'deepEquals' , ( ) => {
@@ -7,4 +7,24 @@ describe('equals', () => {
7
7
expect ( deepEquals ( [ { prop : 'prop' } ] , [ { prop : 'prop' } ] ) ) . toBe ( true ) ;
8
8
expect ( deepEquals ( [ { prop : 'prop' } ] , [ { prop : 'prop2' } ] ) ) . toBe ( false ) ;
9
9
} ) ;
10
+
11
+ test ( 'strictEquals' , ( ) => {
12
+ expect ( strictEquals ( '1' , 1 as unknown as string ) ) . toBe ( false ) ;
13
+ expect ( strictEquals ( '1' , '1' ) ) . toBe ( true ) ;
14
+ } ) ;
15
+
16
+ test ( 'sameArrayItems' , ( ) => {
17
+ expect ( sameArrayItems ( [ ] , [ ] , strictEquals ) ) . toBe ( true ) ;
18
+ expect ( sameArrayItems ( [ 'a' ] , [ 'a' , 'b' ] , strictEquals ) ) . toBe ( false ) ;
19
+ expect ( sameArrayItems ( [ 'a' , 'b' ] , [ 'a' , 'b' ] , strictEquals ) ) . toBe ( true ) ;
20
+ expect ( sameArrayItems ( [ 'a' , 'b' ] , [ 'b' , 'a' ] , strictEquals ) ) . toBe ( true ) ;
21
+ } ) ;
22
+
23
+ test ( 'shallowArrayEquals' , ( ) => {
24
+ expect ( shallowArrayEquals ( [ ] , [ ] ) ) . toBe ( true ) ;
25
+ const a = { prop : 'prop' } ;
26
+ const b = { prop : 'prop' } ;
27
+ expect ( shallowArrayEquals ( [ a ] , [ b ] ) ) . toBe ( false ) ;
28
+ expect ( shallowArrayEquals ( [ a ] , [ a ] ) ) . toBe ( true ) ;
29
+ } ) ;
10
30
} ) ;
0 commit comments