Skip to content
Snippets Groups Projects
Commit cfad2afc authored by Jure's avatar Jure
Browse files

Merge branch 'fix_teams' into 'master'

fix(server): use TeamInput for updateTeam mutation too

See merge request !378
parents 2c2d0778 b84b369b
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,7 @@ const typeDefs = `
extend type Mutation {
createTeam(input: TeamInput): Team
deleteTeam(id: ID): Team
updateTeam(id: ID, input: String): Team
updateTeam(id: ID, input: TeamInput): Team
}
type Team {
......
const User = require('../../src/models/User')
const Team = require('../../src/models/Team')
const cleanDB = require('../helpers/db_cleaner')
const fixtures = require('../fixtures/fixtures')
const api = require('../helpers/api')
......@@ -7,9 +8,12 @@ const authentication = require('../../src/authentication')
describe('GraphQL core mutations', () => {
let token
let user
let team
beforeEach(async () => {
await cleanDB()
user = await new User(fixtures.adminUser).save()
team = await new Team(fixtures.readerTeam).save()
token = authentication.token.create(user)
})
......@@ -111,6 +115,29 @@ describe('GraphQL core mutations', () => {
})
})
it('can update a team', async () => {
const { body } = await api.graphql.query(
`mutation($id: ID, $input: TeamInput) {
updateTeam(id: $id, input: $input) { name }
}`,
{
id: team.id,
input: {
name: 'Updated Team',
},
},
token,
)
expect(body).toEqual({
data: {
updateTeam: {
name: 'Updated Team',
},
},
})
})
it('sets owners when creating a collection', async () => {
const { body } = await api.graphql.query(
`mutation($input: CollectionInput) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment