console/integration-tests/tests/api/user.spec.ts
2025-12-09 00:07:41 +09:00

48 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),
},
},
},
});
});