From 8dd461d850353ebb6b493baad718474ade89e773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Tue, 9 Apr 2019 12:09:58 +0200 Subject: [PATCH] Implement NotificationList without store implement --- backend/src/seed/seed-db.js | 2 +- .../notifications/NotificationList.spec.js | 14 ++++---------- .../notifications/NotificationList.vue | 2 +- webapp/store/auth.js | 17 ----------------- webapp/store/notifications.js | 5 ----- 5 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 webapp/store/notifications.js diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 45b4d87a9..c8968a90f 100644 --- a/backend/src/seed/seed-db.js +++ b/backend/src/seed/seed-db.js @@ -102,7 +102,7 @@ import Factory from './factories' asTick.create('Post', { id: 'p9' }), asTrick.create('Post', { id: 'p10' }), asTrack.create('Post', { id: 'p11' }), - asAdmin.create('Post', { id: 'p12' }), + asAdmin.create('Post', { id: 'p12', content: `Hey @jenny-rostock, here is another notification for you! ${faker.lorem.paragraph()}` }), asModerator.create('Post', { id: 'p13' }), asUser.create('Post', { id: 'p14' }), asTick.create('Post', { id: 'p15' }) diff --git a/webapp/components/notifications/NotificationList.spec.js b/webapp/components/notifications/NotificationList.spec.js index fc9f85da3..3f120f397 100644 --- a/webapp/components/notifications/NotificationList.spec.js +++ b/webapp/components/notifications/NotificationList.spec.js @@ -118,21 +118,15 @@ describe('NotificationList.vue', () => { describe('click on a notification', () => { beforeEach(() => { wrapper - .findAll('a') + .findAll(Notification) .at(1) .trigger('click') }) it('marks notification as read', () => { - expect(actions['notifications/markAsRead'].mock.calls[0][1]).toEqual(42) - }) - - describe('given mutation resolves', () => { - it.skip('updates currentUser.notifications', () => {}) - }) - - describe('given mutation rejects', () => { - it.skip('displays error warning', () => {}) + expect(actions['notifications/markAsRead'].mock.calls[0][1]).toEqual( + 'notification-42' + ) }) }) }) diff --git a/webapp/components/notifications/NotificationList.vue b/webapp/components/notifications/NotificationList.vue index 7f4cc0e95..3988f257c 100644 --- a/webapp/components/notifications/NotificationList.vue +++ b/webapp/components/notifications/NotificationList.vue @@ -4,7 +4,7 @@ v-for="notification in notifications" :key="notification.id" :notification="notification" - @read="markAsRead(42)" + @read="markAsRead(notification.id)" /> diff --git a/webapp/store/auth.js b/webapp/store/auth.js index ad55f8b6c..4785ff0c0 100644 --- a/webapp/store/auth.js +++ b/webapp/store/auth.js @@ -83,23 +83,6 @@ export const actions = { role about locationName - notifications(read: false, orderBy: createdAt_desc) { - id - read - createdAt - post { - author { - id - slug - name - disabled - deleted - } - title - contentExcerpt - slug - } - } } }`) }) diff --git a/webapp/store/notifications.js b/webapp/store/notifications.js deleted file mode 100644 index c596f6b15..000000000 --- a/webapp/store/notifications.js +++ /dev/null @@ -1,5 +0,0 @@ -export const actions = { - async markAsRead(_, notificationId) { - console.log('notificationId', notificationId) - } -}