Implement NotificationList without store implement

This commit is contained in:
Robert Schäfer 2019-04-09 12:09:58 +02:00
parent 8701b220c1
commit 8dd461d850
5 changed files with 6 additions and 34 deletions

View File

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

View File

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

View File

@ -4,7 +4,7 @@
v-for="notification in notifications"
:key="notification.id"
:notification="notification"
@read="markAsRead(42)"
@read="markAsRead(notification.id)"
/>
</div>
</template>

View File

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

View File

@ -1,5 +0,0 @@
export const actions = {
async markAsRead(_, notificationId) {
console.log('notificationId', notificationId)
}
}