mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Fixe error toast test.
This commit is contained in:
parent
ddb9d457d2
commit
6c8f5c5772
@ -91,7 +91,7 @@ describe('Login', () => {
|
||||
apolloQueryMock.mockRejectedValue({
|
||||
message: 'Failed to get communities',
|
||||
})
|
||||
wrapper = new Wrapper()
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('toasts an error message', () => {
|
||||
|
||||
@ -9,6 +9,19 @@ const spinnerMock = jest.fn(() => {
|
||||
hide: spinnerHideMock,
|
||||
}
|
||||
})
|
||||
const apolloQueryMock = jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
communities: [
|
||||
{
|
||||
name: 'test1',
|
||||
description: 'description 1',
|
||||
url: 'http://test.test/vue',
|
||||
registerUrl: 'http://localhost/vue/register-community',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
const toasterMock = jest.fn()
|
||||
|
||||
describe('RegisterSelectCommunity', () => {
|
||||
let wrapper
|
||||
@ -28,9 +41,15 @@ describe('RegisterSelectCommunity', () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
$apollo: {
|
||||
query: apolloQueryMock,
|
||||
},
|
||||
$loading: {
|
||||
show: spinnerMock,
|
||||
},
|
||||
$toasted: {
|
||||
error: toasterMock,
|
||||
},
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
@ -45,5 +64,18 @@ describe('RegisterSelectCommunity', () => {
|
||||
it('renders the Div Element "#register-select-community"', () => {
|
||||
expect(wrapper.find('div#register-select-community').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('calls the apollo query', () => {
|
||||
beforeEach(() => {
|
||||
apolloQueryMock.mockRejectedValue({
|
||||
message: 'Wrong thing',
|
||||
})
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('toast an error', () => {
|
||||
expect(toasterMock).toBeCalledWith('Wrong thing')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user