diff --git a/packages/server/src/graphql/definitions/team.js b/packages/server/src/graphql/definitions/team.js index 9ffb06f895021b1b9d5a3af35da32d7eef96d233..6161e949249a4639c88d4ef6e4f1f221b2957039 100644 --- a/packages/server/src/graphql/definitions/team.js +++ b/packages/server/src/graphql/definitions/team.js @@ -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 { diff --git a/packages/server/test/graphql/mutations_test.js b/packages/server/test/graphql/mutations_test.js index 38dea5934d4a83a35a39473b7d57ed73b860a9e8..7ab05d2f771961a6ad679ffcdd588b78dba72c74 100644 --- a/packages/server/test/graphql/mutations_test.js +++ b/packages/server/test/graphql/mutations_test.js @@ -1,4 +1,5 @@ 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) {