Disable/enable should return the Resource

This commit is contained in:
Robert Schäfer 2019-03-07 18:31:54 +01:00
parent 389f447186
commit 1377455cda
2 changed files with 17 additions and 12 deletions

View File

@ -37,7 +37,7 @@ afterEach(async () => {
describe('disable', () => {
const mutation = `
mutation($id: ID!, $type: ResourceEnum!) {
disable(resource: { id: $id, type: $type })
disable(resource: { id: $id, type: $type }) { id type }
}
`
let variables
@ -103,8 +103,8 @@ describe('disable', () => {
}
})
it('returns true', async () => {
const expected = { disable: true }
it('returns disabled Resource', async () => {
const expected = { disable: { id: 'c47', type: 'comment' } }
await runSetup()
await expect(action()).resolves.toEqual(expected)
})
@ -154,8 +154,8 @@ describe('disable', () => {
}
})
it('returns true', async () => {
const expected = { disable: true }
it('returns disabled Resource', async () => {
const expected = { disable: { id: 'p9', type: 'contribution' } }
await runSetup()
await expect(action()).resolves.toEqual(expected)
})
@ -195,7 +195,7 @@ describe('disable', () => {
describe('enable', () => {
const mutation = `
mutation($id: ID!, $type: ResourceEnum!) {
enable(resource: { id: $id, type: $type })
enable(resource: { id: $id, type: $type }) { id type }
}
`
let variables
@ -270,8 +270,8 @@ describe('enable', () => {
}
})
it('returns true', async () => {
const expected = { enable: true }
it('returns disabled Resource', async () => {
const expected = { enable: { id: 'c456', type: 'comment' } }
await runSetup()
await expect(action()).resolves.toEqual(expected)
})
@ -331,8 +331,8 @@ describe('enable', () => {
}
})
it('returns true', async () => {
const expected = { enable: true }
it('returns disabled Resource', async () => {
const expected = { enable: { id: 'p9', type: 'contribution' } }
await runSetup()
await expect(action()).resolves.toEqual(expected)
})

View File

@ -7,8 +7,8 @@ type Mutation {
login(email: String!, password: String!): String!
signup(email: String!, password: String!): Boolean!
report(resource: Resource!, description: String): Report
disable(resource: Resource!): Boolean!
enable(resource: Resource!): Boolean!
disable(resource: Resource!): ResourcePayload!
enable(resource: Resource!): ResourcePayload!
}
type Statistics {
@ -32,6 +32,11 @@ input Resource {
type: ResourceEnum!
}
type ResourcePayload {
id: ID!,
type: ResourceEnum!
}
enum ResourceEnum {
contribution
comment