Remove unnecessary negation of negation, refactor

- tests to use `toMatchObject`, which checks that only one notification
  is indeed created
This commit is contained in:
mattwr18 2020-02-18 22:21:49 +01:00
parent f32bfc7e36
commit 7fe6fb110b
2 changed files with 4 additions and 4 deletions

View File

@ -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 => {

View File

@ -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 })
})
})