From 9a8720218f1c9d51e711503b756d167ee985477d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Fri, 24 Jan 2020 19:33:32 +0100 Subject: [PATCH] Implement suggestions of Matt --- .../notifications/notificationsMiddleware.spec.js | 2 +- backend/src/models/Comment.js | 4 ++-- backend/src/models/Post.js | 4 ++-- backend/src/models/Report.js | 4 ++-- backend/src/schema/resolvers/notifications.spec.js | 6 ++++-- backend/src/schema/resolvers/reports.js | 4 +--- cypress/integration/common/steps.js | 2 +- webapp/components/Notification/Notification.vue | 2 +- webapp/components/NotificationList/NotificationList.spec.js | 3 ++- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/backend/src/middleware/notifications/notificationsMiddleware.spec.js b/backend/src/middleware/notifications/notificationsMiddleware.spec.js index 538b0b50c..5ceb597d3 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.spec.js +++ b/backend/src/middleware/notifications/notificationsMiddleware.spec.js @@ -683,7 +683,7 @@ describe('notifications', () => { describe('comment', () => { beforeEach(async () => { - commentContent = 'Commenter's comment.' + commentContent = "Commenter's comment." commentAuthor = await neode.create('User', { id: 'commentAuthor', name: 'Mrs Comment', diff --git a/backend/src/models/Comment.js b/backend/src/models/Comment.js index add88cbe0..bffd2922b 100644 --- a/backend/src/models/Comment.js +++ b/backend/src/models/Comment.js @@ -35,13 +35,13 @@ export default { type: 'string', isoDate: true, required: true, - default: () => new Date().toISOString() + default: () => new Date().toISOString(), }, updatedAt: { type: 'string', isoDate: true, required: true, - default: () => new Date().toISOString() + default: () => new Date().toISOString(), }, read: { type: 'boolean', default: false }, reason: { diff --git a/backend/src/models/Post.js b/backend/src/models/Post.js index f4d13b7f4..be061b73f 100644 --- a/backend/src/models/Post.js +++ b/backend/src/models/Post.js @@ -27,13 +27,13 @@ export default { type: 'string', isoDate: true, required: true, - default: () => new Date().toISOString() + default: () => new Date().toISOString(), }, updatedAt: { type: 'string', isoDate: true, required: true, - default: () => new Date().toISOString() + default: () => new Date().toISOString(), }, read: { type: 'boolean', default: false }, reason: { diff --git a/backend/src/models/Report.js b/backend/src/models/Report.js index e1d73126c..f54882398 100644 --- a/backend/src/models/Report.js +++ b/backend/src/models/Report.js @@ -59,13 +59,13 @@ export default { type: 'string', isoDate: true, required: true, - default: () => new Date().toISOString() + default: () => new Date().toISOString(), }, updatedAt: { type: 'string', isoDate: true, required: true, - default: () => new Date().toISOString() + default: () => new Date().toISOString(), }, read: { type: 'boolean', default: false }, reason: { diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js index ad7e4482a..238b3c351 100644 --- a/backend/src/schema/resolvers/notifications.spec.js +++ b/backend/src/schema/resolvers/notifications.spec.js @@ -305,7 +305,8 @@ describe('given some notifications', () => { reportedResource: { __typename: 'Comment', id: 'c4', - content: 'I am harassing content in a harassing comment to a bad post !!!', + content: + 'I am harassing content in a harassing comment to a bad post !!!', }, }, ], @@ -419,7 +420,8 @@ describe('given some notifications', () => { reportedResource: { __typename: 'Comment', id: 'c4', - content: 'I am harassing content in a harassing comment to a bad post !!!', + content: + 'I am harassing content in a harassing comment to a bad post !!!', }, }, ], diff --git a/backend/src/schema/resolvers/reports.js b/backend/src/schema/resolvers/reports.js index 6fc7d667d..b0921505d 100644 --- a/backend/src/schema/resolvers/reports.js +++ b/backend/src/schema/resolvers/reports.js @@ -185,9 +185,7 @@ export default { }, }, FILED: { - ...undefinedToNullResolver([ - 'reasonDescription', - ]), + ...undefinedToNullResolver(['reasonDescription']), // Wolle reasonDescription: async (parent, _params, _context, _resolveInfo) => { // if (typeof parent.reasonDescription !== 'undefined') return parent.reasonDescription // return null diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index a333c6f17..304e9b2da 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -371,7 +371,7 @@ When("I log in with the following credentials:", table => { When("open the notification menu and click on the first item", () => { cy.get(".notifications-menu").invoke('show').click(); // "invoke('show')" because of the delay for show the menu - cy.get('[data-test-id="notification-link"]') + cy.get('[data-testid="notification-link"]') .first() .click({ force: true diff --git a/webapp/components/Notification/Notification.vue b/webapp/components/Notification/Notification.vue index 03d7021d3..8b2b41e4d 100644 --- a/webapp/components/Notification/Notification.vue +++ b/webapp/components/Notification/Notification.vue @@ -27,7 +27,7 @@ { beforeEach(() => { // Wolle wrapper.find('.notification-link-for-test').trigger('click') wrapper.getByTestId('notification-link').trigger('click') + expect(wrapper.attributes('id')).toBe('foo') }) - it("emits 'markAsRead' with the id of the notification source", () => { + it.only("emits 'markAsRead' with the id of the notification source", () => { expect(wrapper.emitted('markAsRead')[0]).toEqual(['post-1']) }) })