@@ -75,7 +75,7 @@ test('gc - only walk model props', () => {
75
75
id : types . identifier ,
76
76
modelProp : types . string ,
77
77
arr : types . late ( ( ) =>
78
- types . array ( types . model ( { id : types . identifier , b : types . maybe ( types . string ) } ) )
78
+ types . array ( types . model ( { id : types . identifier , b : types . maybe ( types . string ) } ) ) ,
79
79
) ,
80
80
} )
81
81
. volatile ( ( ) => ( {
@@ -84,7 +84,7 @@ test('gc - only walk model props', () => {
84
84
const idents = new Set ( ) ;
85
85
collectSeenIdentifiers (
86
86
ModelA . create ( { id : '1' , modelProp : 'hey' , arr : [ { id : '3' } ] } ) ,
87
- idents
87
+ idents ,
88
88
) ;
89
89
expect ( idents . size ) . toBe ( 2 ) ;
90
90
} ) ;
@@ -121,7 +121,7 @@ test('useQuery', async () => {
121
121
( ) => q . itemQuery . isLoading ,
122
122
( isLoading ) => {
123
123
loadingStates . push ( isLoading ) ;
124
- }
124
+ } ,
125
125
) ;
126
126
127
127
const Comp = observer ( ( ) => {
@@ -149,7 +149,7 @@ test('useMutation', async () => {
149
149
( ) => q . addItemMutation . isLoading ,
150
150
( isLoading ) => {
151
151
loadingStates . push ( isLoading ) ;
152
- }
152
+ } ,
153
153
) ;
154
154
155
155
const Comp = observer ( ( ) => {
@@ -238,7 +238,7 @@ test('onQueryMore', async () => {
238
238
let isFetchingMoreStates : boolean [ ] = [ false ] ;
239
239
reaction (
240
240
( ) => q . listQuery . isFetchingMore ,
241
- ( isFetchingMore ) => isFetchingMoreStates . push ( isFetchingMore )
241
+ ( isFetchingMore ) => isFetchingMoreStates . push ( isFetchingMore ) ,
242
242
) ;
243
243
244
244
let offset = observable . box ( 0 ) ;
@@ -373,7 +373,7 @@ test('merge of date objects', () => {
373
373
} ,
374
374
} ,
375
375
DateModel ,
376
- queryClient . config . env
376
+ queryClient . config . env ,
377
377
) ;
378
378
const result = merge (
379
379
{
@@ -383,7 +383,7 @@ test('merge of date objects', () => {
383
383
} ,
384
384
} ,
385
385
DateModel ,
386
- queryClient . config . env
386
+ queryClient . config . env ,
387
387
) ;
388
388
expect ( ( getSnapshot ( result ) as any ) . changed . at ) . toBe ( 1583193600000 ) ;
389
389
@@ -402,13 +402,13 @@ test('deep update of object', () => {
402
402
const result = merge (
403
403
{ model : { a : 'banana' } , ref : { id : '1' , a : 'fruit' } } ,
404
404
DeepModelA ,
405
- queryClient . config . env
405
+ queryClient . config . env ,
406
406
) ;
407
407
applySnapshot ( a , result ) ;
408
408
const result2 = merge (
409
409
{ model : { a : 'banana' , b : 'apple' } , ref : { id : '1' , a : 'orange' } } ,
410
410
DeepModelA ,
411
- queryClient . config . env
411
+ queryClient . config . env ,
412
412
) ;
413
413
414
414
applySnapshot ( a , result2 ) ;
@@ -432,7 +432,7 @@ test('merge frozen type', () => {
432
432
rootStore . serviceStore . frozenQuery . __MstQueryHandler . setData ( {
433
433
id : 'test' ,
434
434
frozen : { data1 : 'data1' , data2 : 'data2' } ,
435
- } )
435
+ } ) ,
436
436
) . not . toThrow ( ) ;
437
437
} ) ;
438
438
@@ -458,7 +458,7 @@ test('merge with undefined data and union type', () => {
458
458
id : 'test' ,
459
459
folderPath : 'test' ,
460
460
origin : undefined ,
461
- } )
461
+ } ) ,
462
462
) . not . toThrow ( ) ;
463
463
} ) ;
464
464
@@ -469,13 +469,13 @@ test('findAll', () => {
469
469
470
470
const queries = queryClient . queryStore . getQueries (
471
471
ItemQuery ,
472
- ( query ) => ! ! query . variables . request ?. id . includes ( 't' )
472
+ ( query ) => ! ! query . variables . request ?. id . includes ( 't' ) ,
473
473
) ;
474
474
expect ( queries . length ) . toBe ( 1 ) ;
475
475
476
476
const queries2 = queryClient . queryStore . getQueries (
477
477
ItemQuery ,
478
- ( query ) => ! ! query . variables . request ?. id . includes ( 'o' )
478
+ ( query ) => ! ! query . variables . request ?. id . includes ( 'o' ) ,
479
479
) ;
480
480
expect ( queries2 . length ) . toBe ( 0 ) ;
481
481
} ) ;
@@ -656,7 +656,7 @@ test('support map type', () => {
656
656
} ) ;
657
657
658
658
expect ( rootStore . serviceStore . frozenQuery . data ?. amountLimit ?. content ?. get ( 'native' ) ?. tag ) . toBe (
659
- 'Limited'
659
+ 'Limited' ,
660
660
) ;
661
661
} ) ;
662
662
@@ -670,7 +670,7 @@ test('merge with partial data', () => {
670
670
optionalProps1 : 'optional' ,
671
671
optionalProps2 : [ 'optional' ] ,
672
672
optionalProps3 : { a : 'a' } ,
673
- } )
673
+ } ) ,
674
674
) . not . toThrow ( ) ;
675
675
expect ( rootStore . serviceStore . frozenQuery . data ?. id ) . toBe ( 'test' ) ;
676
676
expect ( rootStore . serviceStore . frozenQuery . data ?. origin ) . toBe ( 'a' ) ;
@@ -860,15 +860,15 @@ test('useQuery should not run when initialData is passed and staleTime is larger
860
860
( ) => q . itemQuery . isLoading ,
861
861
( isLoading ) => {
862
862
loadingStates . push ( isLoading ) ;
863
- }
863
+ } ,
864
864
) ;
865
865
866
866
let dataStates : any [ ] = [ ] ;
867
867
const dataReaction = reaction (
868
868
( ) => q . itemQuery . data ,
869
869
( data : any ) => {
870
870
dataStates . push ( data ? data . id : null ) ;
871
- }
871
+ } ,
872
872
) ;
873
873
874
874
const Comp = observer ( ( ) => {
@@ -884,7 +884,7 @@ test('useQuery should not run when initialData is passed and staleTime is larger
884
884
await wait ( 0 ) ;
885
885
886
886
expect ( loadingStates ) . toEqual ( [ ] ) ;
887
- expect ( dataStates ) . toEqual ( [ " test" ] ) ;
887
+ expect ( dataStates ) . toEqual ( [ ' test' ] ) ;
888
888
expect ( q . itemQuery . data ?. id ) . toBe ( 'test' ) ;
889
889
890
890
id . set ( 'different-test' ) ;
@@ -893,15 +893,14 @@ test('useQuery should not run when initialData is passed and staleTime is larger
893
893
expect ( q . itemQuery . data ?. id ) . toBe ( 'test' ) ;
894
894
expect ( q . itemQuery . variables . request ?. id ) . toBe ( 'different-test' ) ;
895
895
expect ( loadingStates ) . toEqual ( [ ] ) ;
896
- expect ( dataStates ) . toEqual ( [ " test" ] ) ;
897
-
896
+ expect ( dataStates ) . toEqual ( [ ' test' ] ) ;
897
+
898
898
isLoadingReaction ( ) ;
899
899
dataReaction ( ) ;
900
900
901
901
configureMobx ( { enforceActions : 'observed' } ) ;
902
902
} ) ;
903
903
904
-
905
904
test ( 'useQuery should run when initialData is passed and initialDataUpdatedAt is older than staleTime' , async ( ) => {
906
905
const { render, q } = setup ( ) ;
907
906
@@ -969,7 +968,7 @@ test('useQuery should run when initialData is given and invalidate is called', a
969
968
expect ( loadingStates ) . toEqual ( [ false , true , false ] ) ;
970
969
971
970
disposer ( ) ;
972
- configureMobx ( { enforceActions : 'observed' } ) ;
971
+ configureMobx ( { enforceActions : 'observed' } ) ;
973
972
} ) ;
974
973
975
974
test ( 'refetchOnMount & refetchOnRequestChanged' , async ( ) => {
@@ -1094,14 +1093,14 @@ test('render null when request changes', async () => {
1094
1093
1095
1094
configureMobx ( { enforceActions : 'never' } ) ;
1096
1095
1097
- let id = observable . box ( 'test' ) ;
1096
+ let id = observable . box ( 'test' ) ;
1098
1097
1099
1098
let dataStates : any [ ] = [ ] ;
1100
1099
const sub = reaction (
1101
1100
( ) => q . itemQuery . data ,
1102
1101
( data : any ) => {
1103
1102
dataStates . push ( data ) ;
1104
- }
1103
+ } ,
1105
1104
) ;
1106
1105
1107
1106
const Comp = observer ( ( ) => {
@@ -1113,16 +1112,14 @@ test('render null when request changes', async () => {
1113
1112
1114
1113
render ( < Comp /> ) ;
1115
1114
await wait ( 0 ) ;
1116
-
1117
- expect ( dataStates . length ) . toBe ( 1 ) ; ;
1115
+
1116
+ expect ( dataStates . length ) . toBe ( 1 ) ;
1118
1117
1119
1118
id . set ( 'different-test' ) ;
1120
1119
await wait ( 0 ) ;
1121
-
1120
+
1122
1121
expect ( dataStates [ 1 ] ) . toBe ( null ) ;
1123
1122
expect ( dataStates [ 2 ] . id ) . toBe ( 'different-test' ) ;
1124
1123
1125
1124
configureMobx ( { enforceActions : 'observed' } ) ;
1126
1125
} ) ;
1127
-
1128
- // TODO: Pass in onQueryMore and endpoint directly to useQuery, does this even work?
0 commit comments