@@ -21,17 +21,19 @@ describe('getBy', () => {
21
21
mother : {
22
22
name : 'Lisa' ,
23
23
} ,
24
- siblings : [ {
25
- name : undefined
26
- } ]
24
+ siblings : [
25
+ {
26
+ name : undefined ,
27
+ } ,
28
+ ] ,
27
29
}
28
30
29
31
it ( 'should get subfields by path' , ( ) => {
30
- const name = getBy ( structure , 'name' ) ;
32
+ const name = getBy ( structure , 'name' )
31
33
expect ( name . value ) . toBe ( structure . name )
32
34
expect ( name . found ) . toBe ( true )
33
35
34
- const motherName = getBy ( structure , 'mother.name' ) ;
36
+ const motherName = getBy ( structure , 'mother.name' )
35
37
expect ( motherName . value ) . toBe ( structure . mother . name )
36
38
expect ( motherName . found ) . toBe ( true )
37
39
} )
@@ -47,22 +49,18 @@ describe('getBy', () => {
47
49
} )
48
50
49
51
it ( 'should get nested array subfields by path' , ( ) => {
50
- const hobbies0 = getBy ( structure , 'kids[0].hobbies[0]' ) ;
51
- expect ( hobbies0 . value ) . toBe (
52
- structure . kids [ 0 ] ! . hobbies [ 0 ] ,
53
- )
52
+ const hobbies0 = getBy ( structure , 'kids[0].hobbies[0]' )
53
+ expect ( hobbies0 . value ) . toBe ( structure . kids [ 0 ] ! . hobbies [ 0 ] )
54
54
expect ( hobbies0 . found ) . toBe ( true )
55
55
56
- const hobbies1 = getBy ( structure , 'kids[0].hobbies[1]' ) ;
57
- expect ( hobbies1 . value ) . toBe (
58
- structure . kids [ 0 ] ! . hobbies [ 1 ] ,
59
- )
56
+ const hobbies1 = getBy ( structure , 'kids[0].hobbies[1]' )
57
+ expect ( hobbies1 . value ) . toBe ( structure . kids [ 0 ] ! . hobbies [ 1 ] )
60
58
expect ( hobbies1 . found ) . toBe ( true )
61
59
} )
62
60
63
61
it ( 'should differentiate between explicit undefined vs. no path' , ( ) => {
64
- const sibling0 = getBy ( structure , 'siblings[0].name' ) ;
65
- const sibling1 = getBy ( structure , 'siblings[1].name' ) ;
62
+ const sibling0 = getBy ( structure , 'siblings[0].name' )
63
+ const sibling1 = getBy ( structure , 'siblings[1].name' )
66
64
67
65
expect ( sibling0 . value ) . toBeUndefined ( )
68
66
expect ( sibling1 . value ) . toBeUndefined ( )
0 commit comments