Hey Dude, #Democracy should work equal for everybody!? That seems to be the only way to have equal #Liberty for everyone.
' - const postWithHastagsQuery = gql ` + const postWithHastagsQuery = gql` query($id: ID) { Post(id: $id) { tags { @@ -323,7 +326,7 @@ describe('Hashtags', () => { const postWithHastagsVariables = { id: postId, } - const createPostMutation = gql ` + const createPostMutation = gql` mutation($postId: ID, $postTitle: String!, $postContent: String!) { CreatePost(id: $postId, title: $postTitle, content: $postContent) { id @@ -351,11 +354,14 @@ describe('Hashtags', () => { }) it('both Hashtags are created with the "id" set to their "name"', async () => { - const expected = [{ - id: 'Democracy' - }, { - id: 'Liberty' - }] + const expected = [ + { + id: 'Democracy', + }, + { + id: 'Liberty', + }, + ] await expect( query({ query: postWithHastagsQuery, @@ -364,9 +370,11 @@ describe('Hashtags', () => { ).resolves.toEqual( expect.objectContaining({ data: { - Post: [{ - tags: expect.arrayContaining(expected), - }, ], + Post: [ + { + tags: expect.arrayContaining(expected), + }, + ], }, }), ) @@ -376,7 +384,7 @@ describe('Hashtags', () => { // The already existing Hashtag has no class at this point. const updatedPostContent = 'Hey Dude, #Elections should work equal for everybody!? That seems to be the only way to have equal #Liberty for everyone.
' - const updatePostMutation = gql ` + const updatePostMutation = gql` mutation($postId: ID!, $postTitle: String!, $updatedPostContent: String!) { UpdatePost(id: $postId, title: $postTitle, content: $updatedPostContent) { id @@ -396,11 +404,14 @@ describe('Hashtags', () => { }, }) - const expected = [{ - id: 'Elections' - }, { - id: 'Liberty' - }] + const expected = [ + { + id: 'Elections', + }, + { + id: 'Liberty', + }, + ] await expect( query({ query: postWithHastagsQuery, @@ -409,9 +420,11 @@ describe('Hashtags', () => { ).resolves.toEqual( expect.objectContaining({ data: { - Post: [{ - tags: expect.arrayContaining(expected), - }, ], + Post: [ + { + tags: expect.arrayContaining(expected), + }, + ], }, }), ) @@ -419,4 +432,4 @@ describe('Hashtags', () => { }) }) }) -}) \ No newline at end of file +}) diff --git a/backend/src/middleware/index.js b/backend/src/middleware/index.js index f155f5648..9d9ce7e35 100644 --- a/backend/src/middleware/index.js +++ b/backend/src/middleware/index.js @@ -12,7 +12,7 @@ import user from './userMiddleware' import includedFields from './includedFieldsMiddleware' import orderBy from './orderByMiddleware' import validation from './validation/validationMiddleware' -import handleNotifications from './handleNotifications/handleNotifications' +import handleNotifications from './handleNotifications/handleNotificationsMiddleware' import email from './email/emailMiddleware' export default schema => { diff --git a/backend/src/models/Notification.js b/backend/src/models/Notification.js index 89de27aec..93c4cd6cb 100644 --- a/backend/src/models/Notification.js +++ b/backend/src/models/Notification.js @@ -32,4 +32,4 @@ module.exports = { target: 'Post', direction: 'in', }, -} \ No newline at end of file +} diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js index 313376a25..99dc2fcd3 100644 --- a/backend/src/schema/resolvers/notifications.spec.js +++ b/backend/src/schema/resolvers/notifications.spec.js @@ -1,12 +1,6 @@ -import { - GraphQLClient -} from 'graphql-request' +import { GraphQLClient } from 'graphql-request' import Factory from '../../seed/factories' -import { - host, - login, - gql -} from '../../jest/helpers' +import { host, login, gql } from '../../jest/helpers' const factory = Factory() let client @@ -25,7 +19,7 @@ afterEach(async () => { }) describe('query for notification', () => { - const notificationQuery = gql ` + const notificationQuery = gql` { Notification { id @@ -161,7 +155,7 @@ describe('currentUser notifications', () => { }) describe('filter for read: false', () => { - const queryCurrentUserNotificationsFilterRead = gql ` + const queryCurrentUserNotificationsFilterRead = gql` query($read: Boolean) { currentUser { notifications(read: $read, orderBy: createdAt_desc) { @@ -182,7 +176,8 @@ describe('currentUser notifications', () => { it('returns only unread notifications of current user', async () => { const expected = { currentUser: { - notifications: expect.arrayContaining([{ + notifications: expect.arrayContaining([ + { id: 'post-mention-unseen', post: { id: 'p1', @@ -206,7 +201,7 @@ describe('currentUser notifications', () => { }) describe('no filters', () => { - const queryCurrentUserNotifications = gql ` + const queryCurrentUserNotifications = gql` { currentUser { notifications(orderBy: createdAt_desc) { @@ -224,7 +219,8 @@ describe('currentUser notifications', () => { it('returns all notifications of current user', async () => { const expected = { currentUser: { - notifications: expect.arrayContaining([{ + notifications: expect.arrayContaining([ + { id: 'post-mention-unseen', post: { id: 'p1', @@ -265,7 +261,7 @@ describe('currentUser notifications', () => { }) describe('UpdateNotification', () => { - const mutationUpdateNotification = gql ` + const mutationUpdateNotification = gql` mutation($id: ID!, $read: Boolean) { UpdateNotification(id: $id, read: $read) { id @@ -402,4 +398,4 @@ describe('UpdateNotification', () => { }) }) }) -}) \ No newline at end of file +})