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', {