@@ -678,7 +678,6 @@ describe('Onyx', () => {
678678 } ) ;
679679
680680 it ( 'Should NOT evict keys that are not in safeEvictionKeys list when cache limit is reached' , ( ) => {
681- // Given Onyx keys configuration
682681 const testKeys = {
683682 ...ONYX_KEYS ,
684683 SAFE_FOR_EVICTION : 'evictable_' ,
@@ -693,7 +692,6 @@ describe('Onyx', () => {
693692 const evictableKey2 = `${ testKeys . SAFE_FOR_EVICTION } 2` ;
694693 const evictableKey3 = `${ testKeys . SAFE_FOR_EVICTION } 3` ;
695694
696- // Given storage with some data
697695 StorageMock . getItem . mockResolvedValue ( '"mockValue"' ) ;
698696 const allKeys = [
699697 // Keys that should be evictable
@@ -707,7 +705,6 @@ describe('Onyx', () => {
707705 ] ;
708706 StorageMock . getAllKeys . mockResolvedValue ( allKeys ) ;
709707
710- // Given Onyx with a very small cache limit to force eviction
711708 return initOnyx ( {
712709 keys : testKeys ,
713710 maxCachedKeysCount : 3 , // Only allow 3 keys in cache
@@ -733,17 +730,8 @@ describe('Onyx', () => {
733730 } )
734731 . then ( waitForPromisesToResolve )
735732 . then ( ( ) => {
736- // Get which keys were kept in cache
737733 const nonEvictableKeysInCache = [ cache . hasCacheForKey ( criticalKey1 ) , cache . hasCacheForKey ( criticalKey2 ) , cache . hasCacheForKey ( criticalKey3 ) ] ;
738734
739- const evictableKeysInCache = [ cache . hasCacheForKey ( evictableKey1 ) , cache . hasCacheForKey ( evictableKey2 ) , cache . hasCacheForKey ( evictableKey3 ) ] ;
740-
741- // Print results for debugging
742- // eslint-disable-next-line no-console
743- console . log ( 'Non-evictable keys in cache:' , nonEvictableKeysInCache ) ;
744- // eslint-disable-next-line no-console
745- console . log ( 'Evictable keys in cache:' , evictableKeysInCache ) ;
746-
747735 // Bug demonstration: This test should FAIL because critical keys are incorrectly evicted
748736 // The current implementation evicts based on LRU order, not respecting safeEvictionKeys
749737 expect ( nonEvictableKeysInCache . every ( ( inCache ) => inCache ) ) . toBe ( true ) ;
0 commit comments