mirror of
https://github.com/graphql-hive/console
synced 2026-04-29 10:27:17 +00:00
49 lines
1,014 B
TypeScript
49 lines
1,014 B
TypeScript
|
|
import { graphql } from 'testkit/gql';
|
||
|
|
import { execute } from 'testkit/graphql';
|
||
|
|
import { initSeed } from 'testkit/seed';
|
||
|
|
|
||
|
|
const UpdateMeMutation = graphql(`
|
||
|
|
mutation UsersSpecUpdateMe($input: UpdateMeInput!) {
|
||
|
|
updateMe(input: $input) {
|
||
|
|
error {
|
||
|
|
message
|
||
|
|
}
|
||
|
|
ok {
|
||
|
|
updatedUser {
|
||
|
|
id
|
||
|
|
displayName
|
||
|
|
fullName
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
`);
|
||
|
|
|
||
|
|
test('can update full name and display name', async () => {
|
||
|
|
const { ownerToken } = await initSeed().createOwner();
|
||
|
|
|
||
|
|
const result = await execute({
|
||
|
|
document: UpdateMeMutation,
|
||
|
|
variables: {
|
||
|
|
input: {
|
||
|
|
displayName: 'vegapunk',
|
||
|
|
fullName: 'Vincent Vega',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
authToken: ownerToken,
|
||
|
|
}).then(res => res.expectNoGraphQLErrors());
|
||
|
|
|
||
|
|
expect(result).toEqual({
|
||
|
|
updateMe: {
|
||
|
|
error: null,
|
||
|
|
ok: {
|
||
|
|
updatedUser: {
|
||
|
|
displayName: 'vegapunk',
|
||
|
|
fullName: 'Vincent Vega',
|
||
|
|
id: expect.any(String),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|
||
|
|
});
|