From 58e3429c3153d4a8f9ed1705824af83f6a68a957 Mon Sep 17 00:00:00 2001 From: Kapil Jain Date: Sun, 20 Oct 2019 10:52:20 -0400 Subject: [PATCH] Implemented review comments - moved new tests in their own 'it' blocks. --- backend/src/schema/resolvers/follow.spec.js | 12 +++++++++++- backend/src/schema/resolvers/shout.spec.js | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/backend/src/schema/resolvers/follow.spec.js b/backend/src/schema/resolvers/follow.spec.js index 0c186a139..ea634c67e 100644 --- a/backend/src/schema/resolvers/follow.spec.js +++ b/backend/src/schema/resolvers/follow.spec.js @@ -129,8 +129,18 @@ describe('follow', () => { data: { followUser: expectedUser }, errors: undefined, }) + }) - // Test to make sure FOLLOWS relationship has "createdAt" date. + test('adds `createdAt` to `FOLLOW` relationship', async () => { + const expectedUser = { + name: user2.name, + followedBy: [{ id: user1.id, name: user1.name }], + followedByCurrentUser: true, + } + await mutate({ + mutation: mutationFollowUser, + variables, + }) const relation = await neode.cypher( 'MATCH (user:User {id: {id}})-[relationship:FOLLOWS]->(followed:User) WHERE relationship.createdAt IS NOT NULL RETURN relationship', { id: 'u1' }, diff --git a/backend/src/schema/resolvers/shout.spec.js b/backend/src/schema/resolvers/shout.spec.js index 6554ea7f8..462dc15be 100644 --- a/backend/src/schema/resolvers/shout.spec.js +++ b/backend/src/schema/resolvers/shout.spec.js @@ -100,7 +100,11 @@ describe('shout and unshout posts', () => { data: { Post: [{ id: 'another-user-post-id', shoutedBy: [{ id: 'current-user-id' }] }] }, errors: undefined, }) - // Test to make sure SHOUT relationship has "createdAt" date. + }) + + it('adds `createdAt` to `SHOUT` relationship', async () => { + variables = { id: 'another-user-post-id' } + await mutate({ mutation: mutationShoutPost, variables }) const relation = await instance.cypher( 'MATCH (user:User {id: $userId1})-[relationship:SHOUTED]->(node {id: $userId2}) WHERE relationship.createdAt IS NOT NULL RETURN relationship', {