Switch ACL to Relay Global Id (#6495)

This commit is contained in:
Antoine Cormouls
2020-03-23 09:35:42 +01:00
committed by GitHub
parent 1b8f057904
commit 312a4bc812
3 changed files with 22 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ const { SubscriptionClient } = require('subscriptions-transport-ws');
const { WebSocketLink } = require('apollo-link-ws');
const ApolloClient = require('apollo-client').default;
const gql = require('graphql-tag');
const { toGlobalId } = require('graphql-relay');
const {
GraphQLObjectType,
GraphQLString,
@@ -8284,6 +8285,18 @@ describe('ParseGraphQLServer', () => {
await parseGraphQLServer.parseGraphQLSchema.databaseController.schemaCache.clear();
const gqlUser = (
await apolloClient.query({
query: gql`
query getUser($id: ID!) {
user(id: $id) {
id
}
}
`,
variables: { id: user.id },
})
).data.user;
const {
data: { createSomeClass },
} = await apolloClient.mutate({
@@ -8317,7 +8330,7 @@ describe('ParseGraphQLServer', () => {
fields: {
ACL: {
users: [
{ userId: user.id, read: true, write: true },
{ userId: gqlUser.id, read: true, write: true },
{ userId: user2.id, read: true, write: false },
],
roles: [
@@ -8334,13 +8347,13 @@ describe('ParseGraphQLServer', () => {
__typename: 'ACL',
users: [
{
userId: user.id,
userId: toGlobalId('_User', user.id),
read: true,
write: true,
__typename: 'UserACL',
},
{
userId: user2.id,
userId: toGlobalId('_User', user2.id),
read: true,
write: false,
__typename: 'UserACL',