Test submit of EditCreationFormular, remove getCountPendingCreations.

This commit is contained in:
elweyn 2021-12-04 12:22:48 +01:00 committed by ogerly
parent a5406286fe
commit c7633bb1eb
3 changed files with 39 additions and 7 deletions

View File

@ -39,6 +39,12 @@ const mocks = {
mutate: apolloMutateMock,
},
$store: {
state: {
moderator: {
id: 0,
name: 'test moderator',
},
},
commit: stateCommitMock,
},
}
@ -92,6 +98,8 @@ describe('EditCreationFormular', () => {
jest.clearAllMocks()
await wrapper.setProps({ type: 'singleCreation', creation: [200, 400, 600] })
await wrapper.setData({ rangeMin: 180 })
await wrapper.setData({ text: 'Test create coins' })
await wrapper.setData({ value: 90 })
})
describe('first radio button', () => {
@ -106,6 +114,16 @@ describe('EditCreationFormular', () => {
it('sets rangeMax to 200', () => {
expect(wrapper.vm.rangeMax).toBe(200)
})
describe('sendForm', () => {
beforeEach(async () => {
await wrapper.find('.test-submit').trigger('click')
})
it('sends ... to apollo', () => {
expect(apolloMutateMock).toBeCalled()
})
})
})
describe('second radio button', () => {
@ -120,6 +138,16 @@ describe('EditCreationFormular', () => {
it('sets rangeMax to 400', () => {
expect(wrapper.vm.rangeMax).toBe(400)
})
describe('sendForm', () => {
beforeEach(async () => {
await wrapper.find('.test-submit').trigger('click')
})
it('sends ... to apollo', () => {
expect(apolloMutateMock).toBeCalled()
})
})
})
describe('third radio button', () => {
@ -134,6 +162,16 @@ describe('EditCreationFormular', () => {
it('sets rangeMax to 400', () => {
expect(wrapper.vm.rangeMax).toBe(600)
})
describe('sendForm', () => {
beforeEach(async () => {
await wrapper.find('.test-submit').trigger('click')
})
it('sends ... to apollo', () => {
expect(apolloMutateMock).toBeCalled()
})
})
})
})
})

View File

@ -106,6 +106,7 @@
<b-button
type="button"
variant="success"
class="test-submit"
@click="submitCreation"
:disabled="radioSelected === '' || value <= 0 || text.length < 10"
>

View File

@ -1,7 +0,0 @@
import gql from 'graphql-tag'
export const countPendingCreations = gql`
query {
countPendingCreations
}
`