Skip to content

Commit

Permalink
chore(tests): suppress expected warnings (#2398)
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi authored Mar 8, 2024
1 parent 6f61b76 commit c092d76
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions tests/devtools.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit c092d76

Please sign in to comment.