remove warnings from test

This commit is contained in:
Moriz Wahl 2023-02-14 17:26:21 +01:00
parent 3e894d36bd
commit 0b60759c69

View File

@ -68,13 +68,23 @@ describe('NavBar', () => {
}) })
describe('wallet', () => { describe('wallet', () => {
const assignLocationSpy = jest.fn() const windowLocationMock = jest.fn()
const windowLocation = window.location
beforeEach(async () => { beforeEach(async () => {
delete window.location
window.location = {
assign: windowLocationMock,
}
await wrapper.findAll('.nav-item').at(5).find('a').trigger('click') await wrapper.findAll('.nav-item').at(5).find('a').trigger('click')
}) })
afterEach(() => {
delete window.location
window.location = windowLocation
})
it.skip('changes window location to wallet', () => { it.skip('changes window location to wallet', () => {
expect(assignLocationSpy).toBeCalledWith('valid-token') expect(windowLocationMock()).toBe('valid-token')
}) })
it('dispatches logout to store', () => { it('dispatches logout to store', () => {
@ -84,6 +94,7 @@ describe('NavBar', () => {
describe('logout', () => { describe('logout', () => {
const windowLocationMock = jest.fn() const windowLocationMock = jest.fn()
const windowLocation = window.location
beforeEach(async () => { beforeEach(async () => {
delete window.location delete window.location
window.location = { window.location = {
@ -92,6 +103,11 @@ describe('NavBar', () => {
await wrapper.findAll('.nav-item').at(5).find('a').trigger('click') await wrapper.findAll('.nav-item').at(5).find('a').trigger('click')
}) })
afterEach(() => {
delete window.location
window.location = windowLocation
})
it('redirects to /logout', () => { it('redirects to /logout', () => {
expect(windowLocationMock).toBeCalledWith('http://localhost/login') expect(windowLocationMock).toBeCalledWith('http://localhost/login')
}) })