chore(tests): suppress expected warnings (#2398)

This commit is contained in:
Daishi Kato 2024-03-09 08:51:05 +09:00 committed by GitHub
parent 6f61b76fa0
commit c092d76260
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -636,26 +636,37 @@ describe('with redux middleware', () => {
})
})
it('works in non-browser env', async () => {
const originalWindow = global.window
global.window = undefined as any
describe('different envs', () => {
let savedConsoleWarn: any
beforeEach(() => {
savedConsoleWarn = console.warn
console.warn = vi.fn()
})
afterEach(() => {
console.warn = savedConsoleWarn
})
expect(() => {
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
}).not.toThrow()
it('works in non-browser env', async () => {
const originalWindow = global.window
global.window = undefined as any
global.window = originalWindow
})
expect(() => {
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
}).not.toThrow()
it('works in react native env', async () => {
const originalWindow = global.window
global.window = {} as any
global.window = originalWindow
})
expect(() => {
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
}).not.toThrow()
it('works in react native env', async () => {
const originalWindow = global.window
global.window = {} as any
global.window = originalWindow
expect(() => {
createStore(devtools(() => ({ count: 0 }), { enabled: true }))
}).not.toThrow()
global.window = originalWindow
})
})
it('preserves isRecording after setting from devtools', async () => {