Skip to content

Commit c092d76

Browse files
authored
chore(tests): suppress expected warnings (#2398)
1 parent 6f61b76 commit c092d76

1 file changed

Lines changed: 26 additions & 15 deletions

File tree

tests/devtools.test.tsx

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -636,26 +636,37 @@ describe('with redux middleware', () => {
636636
})
637637
})
638638

639-
it('works in non-browser env', async () => {
640-
const originalWindow = global.window
641-
global.window = undefined as any
639+
describe('different envs', () => {
640+
let savedConsoleWarn: any
641+
beforeEach(() => {
642+
savedConsoleWarn = console.warn
643+
console.warn = vi.fn()
644+
})
645+
afterEach(() => {
646+
console.warn = savedConsoleWarn
647+
})
642648

643-
expect(() => {
644-
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
645-
}).not.toThrow()
649+
it('works in non-browser env', async () => {
650+
const originalWindow = global.window
651+
global.window = undefined as any
646652

647-
global.window = originalWindow
648-
})
653+
expect(() => {
654+
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
655+
}).not.toThrow()
649656

650-
it('works in react native env', async () => {
651-
const originalWindow = global.window
652-
global.window = {} as any
657+
global.window = originalWindow
658+
})
653659

654-
expect(() => {
655-
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
656-
}).not.toThrow()
660+
it('works in react native env', async () => {
661+
const originalWindow = global.window
662+
global.window = {} as any
657663

658-
global.window = originalWindow
664+
expect(() => {
665+
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
666+
}).not.toThrow()
667+
668+
global.window = originalWindow
669+
})
659670
})
660671

661672
it('preserves isRecording after setting from devtools', async () => {

0 commit comments

Comments
 (0)