@@ -321,12 +321,12 @@ describe('reactor fns', () => {
321
321
entry = result . entry
322
322
323
323
} )
324
- it ( 'should update the "any" observers ' , ( ) => {
325
- const expected = Set . of ( 1 )
324
+ it ( 'should update the "any" with getter reference ' , ( ) => {
325
+ const expected = Set . of ( getter )
326
326
const result = nextObserverState . get ( 'any' )
327
327
expect ( is ( expected , result ) ) . toBe ( true )
328
328
} )
329
- it ( 'should not update the "store" observers ' , ( ) => {
329
+ it ( 'should not update the "store" with getter reference ' , ( ) => {
330
330
const expected = Map ( { } )
331
331
const result = nextObserverState . get ( 'stores' )
332
332
expect ( is ( expected , result ) ) . toBe ( true )
@@ -336,6 +336,11 @@ describe('reactor fns', () => {
336
336
const result = nextObserverState . get ( 'nextId' )
337
337
expect ( is ( expected , result ) ) . toBe ( true )
338
338
} )
339
+ it ( 'should update the gettersMap with getter as ref, id as value' , ( ) => {
340
+ const expected = Set . of ( 1 )
341
+ const result = nextObserverState . getIn ( [ 'gettersMap' , getter ] )
342
+ expect ( is ( expected , result ) ) . toBe ( true )
343
+ } )
339
344
it ( 'should update the observerMap' , ( ) => {
340
345
const expected = Map ( [
341
346
[ 1 , Map ( {
@@ -375,20 +380,25 @@ describe('reactor fns', () => {
375
380
nextObserverState = result . observerState
376
381
entry = result . entry
377
382
} )
378
- it ( 'should not update the "any" observers ' , ( ) => {
383
+ it ( 'should not update the "any" getters ' , ( ) => {
379
384
const expected = Set . of ( )
380
385
const result = nextObserverState . get ( 'any' )
381
386
expect ( is ( expected , result ) ) . toBe ( true )
382
387
} )
383
- it ( 'should not update the "store" observers ' , ( ) => {
388
+ it ( 'should update the "store" with getter reference ' , ( ) => {
384
389
const expected = Map ( {
385
- store1 : Set . of ( 1 ) ,
386
- store2 : Set . of ( 1 ) ,
390
+ store1 : Set . of ( getter ) ,
391
+ store2 : Set . of ( getter ) ,
387
392
} )
388
393
389
394
const result = nextObserverState . get ( 'stores' )
390
395
expect ( is ( expected , result ) ) . toBe ( true )
391
396
} )
397
+ it ( 'should update the gettersMap with getter as ref, id as value' , ( ) => {
398
+ const expected = Set . of ( 1 )
399
+ const result = nextObserverState . getIn ( [ 'gettersMap' , getter ] )
400
+ expect ( is ( expected , result ) ) . toBe ( true )
401
+ } )
392
402
it ( 'should increment the nextId' , ( ) => {
393
403
const expected = 2
394
404
const result = nextObserverState . get ( 'nextId' )
@@ -448,12 +458,16 @@ describe('reactor fns', () => {
448
458
it ( 'should return a new ObserverState with all entries containing the getter removed' , ( ) => {
449
459
nextObserverState = fns . removeObserver ( initialObserverState , getter1 )
450
460
const expected = Map ( {
451
- any : Set . of ( 3 ) ,
461
+ any : Set . of ( getter2 ) ,
452
462
stores : Map ( {
453
463
store1 : Set ( ) ,
454
464
store2 : Set ( ) ,
455
465
} ) ,
456
466
nextId : 4 ,
467
+ gettersMap : Map ( [
468
+ [ getter1 , Set ( ) ] ,
469
+ [ getter2 , Set . of ( 3 ) ]
470
+ ] ) ,
457
471
observersMap : Map ( [
458
472
[ 3 , Map ( {
459
473
id : 3 ,
@@ -475,10 +489,14 @@ describe('reactor fns', () => {
475
489
const expected = Map ( {
476
490
any : Set ( ) ,
477
491
stores : Map ( {
478
- store1 : Set . of ( 1 , 2 ) ,
479
- store2 : Set . of ( 1 , 2 ) ,
492
+ store1 : Set . of ( getter1 ) ,
493
+ store2 : Set . of ( getter1 ) ,
480
494
} ) ,
481
495
nextId : 4 ,
496
+ gettersMap : Map ( [
497
+ [ getter1 , Set . of ( 1 , 2 ) ] ,
498
+ [ getter2 , Set ( ) ]
499
+ ] ) ,
482
500
observersMap : Map ( [
483
501
[ 1 , Map ( {
484
502
id : 1 ,
0 commit comments