@@ -61,7 +61,7 @@ describe('Onyx', () => {
6161
6262 afterEach ( ( ) => {
6363 if ( connection ) {
64- Onyx . disconnect ( connection ) ;
64+ connection . unsubscribe ( ) ;
6565 }
6666 return Onyx . clear ( ) ;
6767 } ) ;
@@ -354,7 +354,7 @@ describe('Onyx', () => {
354354 // Expect that the connection to a key with a default value that wasn't changed is not called on clear
355355 expect ( mockCallback ) . toHaveBeenCalledTimes ( 0 ) ;
356356
357- return Onyx . disconnect ( otherTestConnection ) ;
357+ return otherTestConnection . unsubscribe ( ) ;
358358 } ) ;
359359 } ) ;
360360
@@ -400,7 +400,7 @@ describe('Onyx', () => {
400400 . then ( ( ) => {
401401 expect ( testKeyValue ) . toBe ( 'test' ) ;
402402 if ( connection ) {
403- Onyx . disconnect ( connection ) ;
403+ connection . unsubscribe ( ) ;
404404 }
405405 return Onyx . set ( ONYX_KEYS . TEST_KEY , 'test updated' ) ;
406406 } )
@@ -1279,7 +1279,7 @@ describe('Onyx', () => {
12791279 // We set an initial value of 42 for ONYX_KEYS.OTHER_TEST in Onyx.init()
12801280 expect ( otherTestCallback ) . toHaveBeenNthCalledWith ( 1 , 42 , ONYX_KEYS . OTHER_TEST ) ;
12811281 expect ( otherTestCallback ) . toHaveBeenNthCalledWith ( 2 , 'pizza' , ONYX_KEYS . OTHER_TEST ) ;
1282- for ( const id of connections ) Onyx . disconnect ( id ) ;
1282+ for ( const id of connections ) id . unsubscribe ( ) ;
12831283 } ) ,
12841284 ) ;
12851285 } ) ;
@@ -1538,7 +1538,7 @@ describe('Onyx', () => {
15381538 expect ( dogCallback ) . toHaveBeenNthCalledWith ( 1 , undefined , dog ) ;
15391539 expect ( dogCallback ) . toHaveBeenLastCalledWith ( { name : 'Rex' } , dog ) ;
15401540
1541- connections . map ( ( id ) => Onyx . disconnect ( id ) ) ;
1541+ connections . map ( ( id ) => id . unsubscribe ( ) ) ;
15421542 } ) ;
15431543 } ) ;
15441544
@@ -1769,7 +1769,7 @@ describe('Onyx', () => {
17691769 ONYX_KEYS . COLLECTION . ROUTES ,
17701770 ) ;
17711771
1772- connections . map ( ( id ) => Onyx . disconnect ( id ) ) ;
1772+ connections . map ( ( id ) => id . unsubscribe ( ) ) ;
17731773 } ) ;
17741774 } ) ;
17751775
@@ -1856,7 +1856,7 @@ describe('Onyx', () => {
18561856 ONYX_KEYS . COLLECTION . PEOPLE ,
18571857 ) ;
18581858
1859- connections . map ( ( id ) => Onyx . disconnect ( id ) ) ;
1859+ connections . map ( ( id ) => id . unsubscribe ( ) ) ;
18601860 } ) ;
18611861 } ) ;
18621862
@@ -2427,8 +2427,8 @@ describe('Onyx', () => {
24272427 expect ( individualCallback1 ) . toHaveBeenCalledWith ( { id : '1' , name : 'Updated Item 1' } , key1 ) ;
24282428 expect ( individualCallback2 ) . toHaveBeenCalledWith ( { id : '2' , name : 'Updated Item 2' } , key2 ) ;
24292429
2430- Onyx . disconnect ( connection1 ) ;
2431- Onyx . disconnect ( connection2 ) ;
2430+ connection1 . unsubscribe ( ) ;
2431+ connection2 . unsubscribe ( ) ;
24322432 } ) ;
24332433
24342434 it ( 'should not save a RAM-only collection to storage' , async ( ) => {
@@ -4048,7 +4048,7 @@ describe('RAM-only keys should not read from storage', () => {
40484048 expect ( receivedValue ) . toBeUndefined ( ) ;
40494049 expect ( cache . get ( ONYX_KEYS . RAM_ONLY_TEST_KEY ) ) . toBeUndefined ( ) ;
40504050
4051- Onyx . disconnect ( connection ) ;
4051+ connection . unsubscribe ( ) ;
40524052 } ) ;
40534053
40544054 it ( 'should not return stale storage data for RAM-only collection members via multiGet' , async ( ) => {
@@ -4078,7 +4078,7 @@ describe('RAM-only keys should not read from storage', () => {
40784078 expect ( cache . get ( collectionMember1 ) ) . toBeUndefined ( ) ;
40794079 expect ( cache . get ( collectionMember2 ) ) . toBeUndefined ( ) ;
40804080
4081- Onyx . disconnect ( connection ) ;
4081+ connection . unsubscribe ( ) ;
40824082 } ) ;
40834083
40844084 it ( 'should not include stale RAM-only keys in getAllKeys results' , async ( ) => {
@@ -4159,7 +4159,7 @@ describe('RAM-only keys should not read from storage', () => {
41594159 // Should never receive the stale value
41604160 expect ( receivedValues . every ( ( v ) => v === undefined || v === null ) ) . toBe ( true ) ;
41614161
4162- Onyx . disconnect ( connection ) ;
4162+ connection . unsubscribe ( ) ;
41634163 } ) ;
41644164
41654165 it ( 'should still work correctly for normal keys when RAM-only keys have stale storage data' , async ( ) => {
@@ -4195,8 +4195,8 @@ describe('RAM-only keys should not read from storage', () => {
41954195 // RAM-only key should NOT read stale value from storage
41964196 expect ( ramOnlyValue ) . toBeUndefined ( ) ;
41974197
4198- Onyx . disconnect ( connection1 ) ;
4199- Onyx . disconnect ( connection2 ) ;
4198+ connection1 . unsubscribe ( ) ;
4199+ connection2 . unsubscribe ( ) ;
42004200 } ) ;
42014201
42024202 it ( 'should not sync RAM-only keys from other instances via keepInstancesSync' , async ( ) => {
@@ -4243,8 +4243,8 @@ describe('RAM-only keys should not read from storage', () => {
42434243
42444244 expect ( normalValue ) . toEqual ( 'synced_normal_value' ) ;
42454245
4246- Onyx . disconnect ( connection ) ;
4247- Onyx . disconnect ( connection2 ) ;
4246+ connection . unsubscribe ( ) ;
4247+ connection2 . unsubscribe ( ) ;
42484248 } ) ;
42494249
42504250 it ( 'should notify collection-root and collection member subscribers when a collection member syncs from another instance' , async ( ) => {
@@ -4291,8 +4291,8 @@ describe('RAM-only keys should not read from storage', () => {
42914291 // The collection member subscriber must receive the synced data.
42924292 expect ( collectionMember2 ) . toEqual ( { name : 'entry 2 changed' } ) ;
42934293
4294- Onyx . disconnect ( collectionConn ) ;
4295- Onyx . disconnect ( collectionMember2Conn ) ;
4294+ collectionConn . unsubscribe ( ) ;
4295+ collectionMember2Conn . unsubscribe ( ) ;
42964296 } ) ;
42974297
42984298 it ( 'should notify a collection-root subscriber once when multiple members sync from another instance' , async ( ) => {
@@ -4333,7 +4333,7 @@ describe('RAM-only keys should not read from storage', () => {
43334333 expect ( collection [ `${ ONYX_KEYS . COLLECTION . TEST_KEY } 2` ] ) . toEqual ( { name : 'entry 2' } ) ;
43344334 expect ( collection [ `${ ONYX_KEYS . COLLECTION . TEST_KEY } 3` ] ) . toEqual ( { name : 'entry 3 changed' } ) ;
43354335
4336- Onyx . disconnect ( connection ) ;
4336+ connection . unsubscribe ( ) ;
43374337 } ) ;
43384338
43394339 it ( 'should notify subscribers with undefined when a collection member is removed in another instance' , async ( ) => {
@@ -4378,8 +4378,8 @@ describe('RAM-only keys should not read from storage', () => {
43784378 // The collection-root subscriber must receive the collection without the removed member.
43794379 expect ( collection ) . toEqual ( { [ `${ ONYX_KEYS . COLLECTION . TEST_KEY } 1` ] : { name : 'entry 1' } } ) ;
43804380
4381- Onyx . disconnect ( collectionConn ) ;
4382- Onyx . disconnect ( collectionMember2Conn ) ;
4381+ collectionConn . unsubscribe ( ) ;
4382+ collectionMember2Conn . unsubscribe ( ) ;
43834383 } ) ;
43844384
43854385 it ( 'should serve RAM-only keys from cache and normal keys from storage in multiGet' , async ( ) => {
@@ -4437,7 +4437,7 @@ describe('RAM-only keys should not read from storage', () => {
44374437 const storageValue = await StorageMock . getItem ( ONYX_KEYS . RAM_ONLY_TEST_KEY ) ;
44384438 expect ( storageValue ) . toEqual ( 'stale_value' ) ;
44394439
4440- Onyx . disconnect ( connection ) ;
4440+ connection . unsubscribe ( ) ;
44414441 } ) ;
44424442} ) ;
44434443
0 commit comments