mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'adminPendingCreationQueries' into adminEditPendingCreationQueries
This commit is contained in:
commit
a8919a0b08
@ -3,6 +3,16 @@ import CreationFormular from './CreationFormular.vue'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
|
const apolloMock = jest.fn().mockResolvedValue({
|
||||||
|
data: {
|
||||||
|
verifyLogin: {
|
||||||
|
name: 'success',
|
||||||
|
id: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const stateCommitMock = jest.fn()
|
||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
$moment: jest.fn(() => {
|
$moment: jest.fn(() => {
|
||||||
return {
|
return {
|
||||||
@ -14,6 +24,12 @@ const mocks = {
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
$apollo: {
|
||||||
|
query: apolloMock,
|
||||||
|
},
|
||||||
|
$store: {
|
||||||
|
commit: stateCommitMock,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const propsData = {
|
const propsData = {
|
||||||
@ -39,6 +55,23 @@ describe('CreationFormular', () => {
|
|||||||
expect(wrapper.find('.component-creation-formular').exists()).toBeTruthy()
|
expect(wrapper.find('.component-creation-formular').exists()).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('server sends back moderator data', () => {
|
||||||
|
it('called store commit with mocked data', () => {
|
||||||
|
expect(stateCommitMock).toBeCalledWith('moderator', { name: 'success', id: 0 })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('server throws error for moderator data call', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks()
|
||||||
|
apolloMock.mockRejectedValue({ message: 'Ouch!' })
|
||||||
|
wrapper = Wrapper()
|
||||||
|
})
|
||||||
|
it('has called store commit with fake data', () => {
|
||||||
|
expect(stateCommitMock).toBeCalledWith('moderator', { id: 0, name: 'Test Moderator' })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('radio buttons to selcet month', () => {
|
describe('radio buttons to selcet month', () => {
|
||||||
it('has three radio buttons', () => {
|
it('has three radio buttons', () => {
|
||||||
expect(wrapper.findAll('input[type="radio"]').length).toBe(3)
|
expect(wrapper.findAll('input[type="radio"]').length).toBe(3)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user