mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Added tests for SHOUT and FOLLOW relationships to make sure they have "createdAt" date.
This commit is contained in:
parent
f73ff995e1
commit
6b72772bbb
@ -113,4 +113,4 @@ module.exports = {
|
||||
target: 'Location',
|
||||
direction: 'out',
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@ -126,12 +126,20 @@ describe('follow', () => {
|
||||
variables,
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
data: { followUser: expectedUser },
|
||||
data: {followUser: expectedUser},
|
||||
errors: undefined,
|
||||
})
|
||||
// Test to make sure FOLLOWS relationship has "createdAt" date.
|
||||
let relation = await neode.cypher(
|
||||
'MATCH (user:User {id: {id}})-[relationship:FOLLOWS]->(followed:User) WHERE relationship.createdAt IS NOT NULL RETURN relationship',
|
||||
{ id: 'u1' },
|
||||
)
|
||||
const relationshipProperties = relation.records.map(record => record.get('relationship').properties.createdAt)
|
||||
expect(relationshipProperties[0]).toEqual(expect.any(String))
|
||||
})
|
||||
|
||||
test('I can`t follow myself', async () => {
|
||||
|
||||
test('I can`t follow myself', async () => {
|
||||
variables.id = user1.id
|
||||
await expect(mutate({ mutation: mutationFollowUser, variables })).resolves.toMatchObject({
|
||||
data: { followUser: null },
|
||||
@ -153,9 +161,9 @@ describe('follow', () => {
|
||||
},
|
||||
errors: undefined,
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('unfollow user', () => {
|
||||
})
|
||||
})
|
||||
describe('unfollow user', () => {
|
||||
beforeEach(async () => {
|
||||
variables = { id: user2.id }
|
||||
await mutate({ mutation: mutationFollowUser, variables })
|
||||
@ -182,5 +190,5 @@ describe('follow', () => {
|
||||
errors: undefined,
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -30,6 +30,10 @@ const queryPost = gql`
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
describe('shout and unshout posts', () => {
|
||||
let currentUser, postAuthor
|
||||
beforeAll(() => {
|
||||
@ -100,6 +104,14 @@ 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.
|
||||
let relation = await instance.cypher(
|
||||
'MATCH (user:User {id: $userId1})-[relationship:SHOUTED]->(node {id: $userId2}) WHERE relationship.createdAt IS NOT NULL RETURN relationship',
|
||||
{ userId1: 'current-user-id', userId2: 'another-user-post-id' },
|
||||
)
|
||||
const relationshipProperties = relation.records.map(record => record.get('relationship').properties.createdAt)
|
||||
expect(relationshipProperties[0]).toEqual(expect.any(String))
|
||||
|
||||
})
|
||||
|
||||
it('can not shout my own post', async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user