File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -207,11 +207,14 @@ describe('IndexDB StorageController', () => {
207
207
} ) ;
208
208
209
209
it ( 'handle indexedDB is not accessible' , async ( ) => {
210
- jest . spyOn ( idbKeyVal , 'createStore' )
211
- . mockImplementationOnce ( ( ) => { throw new Error ( 'Protected' ) ; } ) ;
212
- const dbController = require ( '../IndexedDBStorageController' ) ;
213
- expect ( idbKeyVal . createStore ) . toHaveBeenCalled ( ) ;
214
- expect ( dbController ) . toBeUndefined ( ) ;
210
+ jest . isolateModules ( ( ) => {
211
+ global . indexedDB = mockIndexedDB ;
212
+ jest . spyOn ( idbKeyVal , 'createStore' )
213
+ . mockImplementationOnce ( ( ) => { throw new Error ( 'Protected' ) ; } ) ;
214
+ const dbController = require ( '../IndexedDBStorageController' ) ;
215
+ expect ( dbController ) . toBeUndefined ( ) ;
216
+ expect ( idbKeyVal . createStore ) . toHaveBeenCalled ( ) ;
217
+ } ) ;
215
218
} ) ;
216
219
} ) ;
217
220
You can’t perform that action at this time.
0 commit comments