File tree Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -520,21 +520,10 @@ test('raw color values are passed to theme-ui context when custom properties are
520
520
} )
521
521
522
522
test ( 'warns when localStorage is disabled' , ( ) => {
523
- const originalWindow = window
524
-
525
- const mockWindow = new Proxy ( window , {
526
- get : ( obj , prop ) => {
527
- if ( prop === 'localStorage' ) {
528
- throw 'SecurityError: The operation is insecure.'
529
- } else {
530
- return obj [ prop ]
531
- }
532
- } ,
533
- } )
534
-
535
- Object . defineProperty ( global , 'window' , {
536
- value : mockWindow ,
537
- writable : true ,
523
+ Object . defineProperty ( window , 'localStorage' , {
524
+ get : jest . fn ( ( ) => {
525
+ throw 'SecurityError: The operation is insecure.'
526
+ } ) ,
538
527
} )
539
528
540
529
let mode
@@ -550,9 +539,4 @@ test('warns when localStorage is disabled', () => {
550
539
</ ThemeProvider >
551
540
)
552
541
expect ( mode ) . toBe ( 'default' )
553
-
554
- Object . defineProperty ( global , 'window' , {
555
- value : originalWindow ,
556
- writable : true ,
557
- } )
558
542
} )
You can’t perform that action at this time.
0 commit comments