mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-15 01:14:39 +00:00
Add tests in Notification.spec.js
This commit is contained in:
parent
23626fdaf5
commit
48403471d5
@ -167,6 +167,7 @@ describe('Notification', () => {
|
||||
'notifications.reason.mentioned_in_comment',
|
||||
)
|
||||
})
|
||||
|
||||
it('renders title', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.text()).toContain("It's a post title")
|
||||
@ -198,4 +199,71 @@ describe('Notification', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('given a notification about the user has filed a report', () => {
|
||||
beforeEach(() => {
|
||||
propsData.notification = {
|
||||
reason: 'filed_report_on_resource',
|
||||
from: {
|
||||
__typename: 'Report',
|
||||
id: 'reportOnUser',
|
||||
filed: [
|
||||
{
|
||||
reasonCategory: 'discrimination_etc',
|
||||
reasonDescription: 'This user is harassing me with bigoted remarks!',
|
||||
reportedResource: {
|
||||
__typename: 'User',
|
||||
id: 'badWomen',
|
||||
slug: 'mrs.-badwomen',
|
||||
name: 'Mrs. Badwomen',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
it('renders reason', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.find('.reason-text-for-test').text()).toEqual(
|
||||
'notifications.reason.filed_report_on_resource.user',
|
||||
)
|
||||
})
|
||||
|
||||
it('renders title', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.text()).toContain('Mrs. Badwomen')
|
||||
})
|
||||
|
||||
it('renders the identifier "notifications.filedReport.category"', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.text()).toContain('notifications.filedReport.category')
|
||||
})
|
||||
|
||||
it('renders the identifier "notifications.filedReport.description"', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.text()).toContain('notifications.filedReport.description')
|
||||
})
|
||||
|
||||
it('renders the users slug', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.text()).toContain('@mrs.-badwomen')
|
||||
})
|
||||
|
||||
it('has no class "read"', () => {
|
||||
wrapper = Wrapper()
|
||||
expect(wrapper.classes()).not.toContain('read')
|
||||
})
|
||||
|
||||
describe('that is read', () => {
|
||||
beforeEach(() => {
|
||||
propsData.notification.read = true
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('has class "read"', () => {
|
||||
expect(wrapper.classes()).toContain('read')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -25,7 +25,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
markAsRead(notificationSourceId) {
|
||||
// Wolle console.log('markAsRead !!! notificationSourceId: ', notificationSourceId)
|
||||
this.$emit('markAsRead', notificationSourceId)
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user