Skip to content

Commit 9bd1008

Browse files
committed
Get rid of Proxy
1 parent 59a3957 commit 9bd1008

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

packages/theme-ui/test/color-modes.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -520,21 +520,10 @@ test('raw color values are passed to theme-ui context when custom properties are
520520
})
521521

522522
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+
}),
538527
})
539528

540529
let mode
@@ -550,9 +539,4 @@ test('warns when localStorage is disabled', () => {
550539
</ThemeProvider>
551540
)
552541
expect(mode).toBe('default')
553-
554-
Object.defineProperty(global, 'window', {
555-
value: originalWindow,
556-
writable: true,
557-
})
558542
})

0 commit comments

Comments
 (0)