@@ -1065,7 +1065,7 @@ describe('Onyx', () => {
10651065 . then ( ( ) => {
10661066 // Then we expect the callback to be called only once and the initial stored value to be initialCollectionData
10671067 expect ( mockCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1068- expect ( mockCallback ) . toHaveBeenCalledWith ( initialCollectionData , ONYX_KEYS . COLLECTION . TEST_CONNECT_COLLECTION , undefined ) ;
1068+ expect ( mockCallback ) . toHaveBeenCalledWith ( initialCollectionData , ONYX_KEYS . COLLECTION . TEST_CONNECT_COLLECTION ) ;
10691069 } ) ;
10701070 } ) ;
10711071
@@ -1091,10 +1091,10 @@ describe('Onyx', () => {
10911091 expect ( mockCallback ) . toHaveBeenCalledTimes ( 2 ) ;
10921092
10931093 // AND the value for the first call should be null since the collection was not initialized at that point
1094- expect ( mockCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , ONYX_KEYS . COLLECTION . TEST_POLICY , undefined ) ;
1094+ expect ( mockCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , ONYX_KEYS . COLLECTION . TEST_POLICY ) ;
10951095
10961096 // AND the value for the second call should be collectionUpdate since the collection was updated
1097- expect ( mockCallback ) . toHaveBeenNthCalledWith ( 2 , collectionUpdate , ONYX_KEYS . COLLECTION . TEST_POLICY , collectionUpdate ) ;
1097+ expect ( mockCallback ) . toHaveBeenNthCalledWith ( 2 , collectionUpdate , ONYX_KEYS . COLLECTION . TEST_POLICY ) ;
10981098 } )
10991099 ) ;
11001100 } ) ;
@@ -1149,10 +1149,8 @@ describe('Onyx', () => {
11491149 expect ( mockCallback ) . toHaveBeenCalledTimes ( 2 ) ;
11501150
11511151 // AND the value for the second call should be collectionUpdate
1152- expect ( mockCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , ONYX_KEYS . COLLECTION . TEST_POLICY , undefined ) ;
1153- expect ( mockCallback ) . toHaveBeenNthCalledWith ( 2 , collectionUpdate , ONYX_KEYS . COLLECTION . TEST_POLICY , {
1154- [ `${ ONYX_KEYS . COLLECTION . TEST_POLICY } 1` ] : collectionUpdate . testPolicy_1 ,
1155- } ) ;
1152+ expect ( mockCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , ONYX_KEYS . COLLECTION . TEST_POLICY ) ;
1153+ expect ( mockCallback ) . toHaveBeenNthCalledWith ( 2 , collectionUpdate , ONYX_KEYS . COLLECTION . TEST_POLICY ) ;
11561154 } )
11571155 ) ;
11581156 } ) ;
@@ -1187,7 +1185,7 @@ describe('Onyx', () => {
11871185 expect ( mockCallback ) . toHaveBeenCalledTimes ( 2 ) ;
11881186
11891187 // And the value for the second call should be collectionUpdate
1190- expect ( mockCallback ) . toHaveBeenNthCalledWith ( 2 , collectionUpdate , ONYX_KEYS . COLLECTION . TEST_POLICY , { testPolicy_1 : collectionUpdate . testPolicy_1 } ) ;
1188+ expect ( mockCallback ) . toHaveBeenNthCalledWith ( 2 , collectionUpdate , ONYX_KEYS . COLLECTION . TEST_POLICY ) ;
11911189 } )
11921190
11931191 // When merge is called again with the same collection not modified
@@ -1224,8 +1222,8 @@ describe('Onyx', () => {
12241222 { onyxMethod : Onyx . METHOD . MERGE_COLLECTION , key : ONYX_KEYS . COLLECTION . TEST_UPDATE , value : { [ itemKey ] : { a : 'a' } } as GenericCollection } ,
12251223 ] ) . then ( ( ) => {
12261224 expect ( collectionCallback ) . toHaveBeenCalledTimes ( 2 ) ;
1227- expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , ONYX_KEYS . COLLECTION . TEST_UPDATE , undefined ) ;
1228- expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 2 , { [ itemKey ] : { a : 'a' } } , ONYX_KEYS . COLLECTION . TEST_UPDATE , { [ itemKey ] : { a : 'a' } } ) ;
1225+ expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , ONYX_KEYS . COLLECTION . TEST_UPDATE ) ;
1226+ expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 2 , { [ itemKey ] : { a : 'a' } } , ONYX_KEYS . COLLECTION . TEST_UPDATE ) ;
12291227
12301228 expect ( testCallback ) . toHaveBeenCalledTimes ( 2 ) ;
12311229 expect ( testCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , undefined ) ;
@@ -1483,8 +1481,8 @@ describe('Onyx', () => {
14831481 } )
14841482 . then ( ( ) => {
14851483 expect ( collectionCallback ) . toHaveBeenCalledTimes ( 2 ) ;
1486- expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 1 , { [ cat ] : initialValue } , ONYX_KEYS . COLLECTION . ANIMALS , { [ cat ] : initialValue } ) ;
1487- expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 2 , collectionDiff , ONYX_KEYS . COLLECTION . ANIMALS , { [ cat ] : initialValue , [ dog ] : { name : 'Rex' } } ) ;
1484+ expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 1 , { [ cat ] : initialValue } , ONYX_KEYS . COLLECTION . ANIMALS ) ;
1485+ expect ( collectionCallback ) . toHaveBeenNthCalledWith ( 2 , collectionDiff , ONYX_KEYS . COLLECTION . ANIMALS ) ;
14881486
14891487 // Cat hasn't changed from its original value, expect only the initial connect callback
14901488 expect ( catCallback ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -1660,10 +1658,6 @@ describe('Onyx', () => {
16601658 } ,
16611659 } ,
16621660 ONYX_KEYS . COLLECTION . ROUTES ,
1663- {
1664- [ holidayRoute ] : { waypoints : { 0 : 'Bed' , 1 : 'Home' , 2 : 'Beach' , 3 : 'Restaurant' , 4 : 'Home' } } ,
1665- [ routineRoute ] : { waypoints : { 0 : 'Bed' , 1 : 'Home' , 2 : 'Work' , 3 : 'Gym' } } ,
1666- } ,
16671661 ) ;
16681662
16691663 connections . map ( ( id ) => Onyx . disconnect ( id ) ) ;
@@ -1734,7 +1728,6 @@ describe('Onyx', () => {
17341728 [ cat ] : { age : 3 , sound : 'meow' } ,
17351729 } ,
17361730 ONYX_KEYS . COLLECTION . ANIMALS ,
1737- { [ cat ] : { age : 3 , sound : 'meow' } } ,
17381731 ) ;
17391732 expect ( animalsCollectionCallback ) . toHaveBeenNthCalledWith (
17401733 2 ,
@@ -1743,7 +1736,6 @@ describe('Onyx', () => {
17431736 [ dog ] : { size : 'M' , sound : 'woof' } ,
17441737 } ,
17451738 ONYX_KEYS . COLLECTION . ANIMALS ,
1746- { [ dog ] : { size : 'M' , sound : 'woof' } } ,
17471739 ) ;
17481740
17491741 expect ( catCallback ) . toHaveBeenNthCalledWith ( 1 , { age : 3 , sound : 'meow' } , cat ) ;
@@ -1755,7 +1747,6 @@ describe('Onyx', () => {
17551747 [ lisa ] : { age : 21 , car : 'SUV' } ,
17561748 } ,
17571749 ONYX_KEYS . COLLECTION . PEOPLE ,
1758- { [ bob ] : { age : 25 , car : 'sedan' } , [ lisa ] : { age : 21 , car : 'SUV' } } ,
17591750 ) ;
17601751
17611752 connections . map ( ( id ) => Onyx . disconnect ( id ) ) ;
0 commit comments