Merge branch 'main' into v5

This commit is contained in:
daishi 2024-03-09 08:52:19 +09:00
commit b19acdfab7

View File

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