mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Remove unnecessary negation of negation, refactor
- tests to use `toMatchObject`, which checks that only one notification is indeed created
This commit is contained in:
parent
f32bfc7e36
commit
7fe6fb110b
@ -112,7 +112,7 @@ const notifyUsersOfMention = async (label, id, idsOfUsers, reason, context) => {
|
||||
}
|
||||
|
||||
const notifyUsersOfComment = async (label, commentId, postAuthorId, reason, context) => {
|
||||
if (!(context.user.id !== postAuthorId)) return []
|
||||
if (context.user.id === postAuthorId) return []
|
||||
await validateNotifyUsers(label, reason)
|
||||
const session = context.driver.session()
|
||||
const writeTxResultPromise = await session.writeTransaction(async transaction => {
|
||||
|
||||
@ -528,7 +528,7 @@ describe('notifications', () => {
|
||||
})
|
||||
it('sends only one notification with reason commented_on_post, no notification with reason mentioned_in_comment', async () => {
|
||||
await createCommentOnPostAction()
|
||||
const expected = expect.objectContaining({
|
||||
const expected = {
|
||||
data: {
|
||||
notifications: [
|
||||
{
|
||||
@ -543,7 +543,7 @@ describe('notifications', () => {
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
await expect(
|
||||
query({
|
||||
@ -552,7 +552,7 @@ describe('notifications', () => {
|
||||
read: false,
|
||||
},
|
||||
}),
|
||||
).resolves.toEqual(expected)
|
||||
).resolves.toMatchObject(expected, { errors: undefined })
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user