GraphQL: /me pointers not working (#5745)

When using the `/me` endpoint to fetch the current user, it does not fetches data from any Pointer data type field, even though the field was defined in the GraphQL schema.
This commit is contained in:
Douglas Muraoka
2019-07-02 16:15:46 -03:00
committed by Antonio Davi Macedo Coelho de Castro
parent 3d63545ab7
commit 2c4031092e
2 changed files with 95 additions and 6 deletions

View File

@@ -3104,6 +3104,56 @@ describe('ParseGraphQLServer', () => {
expect(resultUserName).toEqual(userName);
expect(resultEmail).toEqual(email);
});
it('should return logged user including pointer', async () => {
const foo = new Parse.Object('Foo');
foo.set('bar', 'hello');
const userName = 'user1',
password = 'user1',
email = 'emailUser1@parse.com';
const user = new Parse.User();
user.setUsername(userName);
user.setPassword(password);
user.setEmail(email);
user.set('userFoo', foo);
await user.signUp();
await parseGraphQLServer.parseGraphQLSchema.databaseController.schemaCache.clear();
const session = await Parse.Session.current();
const result = await apolloClient.query({
query: gql`
query GetCurrentUser {
users {
me {
objectId
sessionToken
userFoo {
bar
}
}
}
}
`,
context: {
headers: {
'X-Parse-Session-Token': session.getSessionToken(),
},
},
});
const {
objectId,
sessionToken,
userFoo: resultFoo,
} = result.data.users.me;
expect(objectId).toEqual(user.id);
expect(sessionToken).toBeDefined();
expect(resultFoo).toBeDefined();
expect(resultFoo.bar).toEqual('hello');
});
});
describe('Users Mutations', () => {