File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -416,6 +416,17 @@ describe('OnyxUtils', () => {
416416 expect ( logInfoSpy ) . toHaveBeenCalledWith ( `Storage Quota Check -- bytesUsed: 0 bytesRemaining: Infinity. Original error: ${ memoryError } ` ) ;
417417 } ) ;
418418
419+ it ( 'should include the error in logAlert when out of storage and getDatabaseSize fails' , async ( ) => {
420+ const dbSizeError = new Error ( 'Failed to estimate storage' ) ;
421+ const logAlertSpy = jest . spyOn ( Logger , 'logAlert' ) ;
422+ StorageMock . setItem = jest . fn ( ) . mockRejectedValue ( memoryError ) ;
423+ StorageMock . getDatabaseSize = jest . fn ( ) . mockRejectedValue ( dbSizeError ) ;
424+
425+ await Onyx . set ( ONYXKEYS . TEST_KEY , { test : 'data' } ) ;
426+
427+ expect ( logAlertSpy ) . toHaveBeenCalledWith ( `Unable to get database size. Original error: ${ memoryError } . getDatabaseSize error: ${ dbSizeError } ` ) ;
428+ } ) ;
429+
419430 it ( 'should not re-add an evicted key to recentlyAccessedKeys after removal' , async ( ) => {
420431 // Re-init with evictable keys so getKeyForEviction() has something to return
421432 Object . assign ( OnyxUtils . getDeferredInitTask ( ) , createDeferredTask ( ) ) ;
You can’t perform that action at this time.
0 commit comments