Use of mutation enable removed, fix fronend tests

- The mutation definition still has to be removed.
This commit is contained in:
Wolfgang Huß 2019-11-06 14:34:24 +01:00
parent a4521b4621
commit d4e7e10f8c
3 changed files with 17 additions and 13 deletions

View File

@ -29,9 +29,7 @@ describe('DisableModal.vue', () => {
$apollo: {
mutate: jest
.fn()
.mockResolvedValueOnce({
enable: 'u4711',
})
.mockResolvedValueOnce()
.mockRejectedValue({
message: 'Not Authorised!',
}),
@ -162,11 +160,13 @@ describe('DisableModal.vue', () => {
expect(mocks.$apollo.mutate).toHaveBeenCalled()
})
it('passes id to mutation', () => {
it('passes parameters to mutation', () => {
const calls = mocks.$apollo.mutate.mock.calls
const [[{ variables }]] = calls
expect(variables).toEqual({
id: 'u4711',
expect(variables).toMatchObject({
resourceId: 'u4711',
disable: true,
closed: false,
})
})

View File

@ -30,7 +30,7 @@ describe('ReleaseModal.vue', () => {
$apollo: {
mutate: jest
.fn()
.mockResolvedValueOnce({ enable: 'u4711' })
.mockResolvedValueOnce()
.mockRejectedValue({ message: 'Not Authorised!' }),
},
location: {
@ -157,11 +157,13 @@ describe('ReleaseModal.vue', () => {
expect(mocks.$apollo.mutate).toHaveBeenCalled()
})
it('passes id to mutation', () => {
it('passes parameters to mutation', () => {
const calls = mocks.$apollo.mutate.mock.calls
const [[{ variables }]] = calls
expect(variables).toEqual({
id: 'u4711',
expect(variables).toMatchObject({
resourceId: 'u4711',
disable: false,
closed: false,
})
})

View File

@ -53,11 +53,13 @@ export default {
// await this.modalData.buttons.confirm.callback()
await this.$apollo.mutate({
mutation: gql`
mutation($id: ID!) {
enable(id: $id)
mutation($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
decide(resourceId: $resourceId, disable: $disable, closed: $closed) {
disable
}
}
`,
variables: { id: this.id },
variables: { resourceId: this.id, disable: false, closed: false },
})
this.$toast.success(this.$t('release.success'))
this.isOpen = false