method tests added

This commit is contained in:
Moriz Wahl 2019-11-08 14:22:04 +01:00
parent e4883b5175
commit 3d3a121dc5

View File

@ -104,12 +104,14 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/post-menu-pin') ).toBe('/post-menu-pin')
items.at(0).trigger('click') items.at(0).trigger('click')
expect(wrapper.emitted('pinPost')).toEqual([[ expect(wrapper.emitted('pinPost')).toEqual([
[
{ {
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8', id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
pinnedBy: null, pinnedBy: null,
} },
]]) ],
])
}) })
it('admin can unpin pinned post', () => { it('admin can unpin pinned post', () => {
@ -131,12 +133,14 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/post-menu-unpin') ).toBe('/post-menu-unpin')
items.at(0).trigger('click') items.at(0).trigger('click')
expect(wrapper.emitted('unpinPost')).toEqual([[ expect(wrapper.emitted('unpinPost')).toEqual([
[
{ {
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8', id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
pinnedBy: 'someone', pinnedBy: 'someone',
} },
]]) ],
])
}) })
}) })
@ -170,7 +174,6 @@ describe('ContentMenu.vue', () => {
).toBe('/comment-menu-delete') ).toBe('/comment-menu-delete')
items.at(1).trigger('click') items.at(1).trigger('click')
expect(openModalSpy).toHaveBeenCalledWith('delete') expect(openModalSpy).toHaveBeenCalledWith('delete')
}) })
}) })
@ -382,9 +385,7 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/release-contribution-title') ).toBe('/release-contribution-title')
items.at(1).trigger('click') items.at(1).trigger('click')
expect(openModalSpy).toHaveBeenCalledWith( expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
'release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8'
)
}) })
it('moderator can release comments', () => { it('moderator can release comments', () => {
@ -407,9 +408,7 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/release-comment-title') ).toBe('/release-comment-title')
items.at(1).trigger('click') items.at(1).trigger('click')
expect(openModalSpy).toHaveBeenCalledWith( expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
'release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8'
)
}) })
it('moderator can release users', () => { it('moderator can release users', () => {
@ -432,9 +431,7 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/release-user-title') ).toBe('/release-user-title')
items.at(1).trigger('click') items.at(1).trigger('click')
expect(openModalSpy).toHaveBeenCalledWith( expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
'release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8'
)
}) })
it('moderator can release organizations', () => { it('moderator can release organizations', () => {
@ -457,9 +454,7 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/release-organization-title') ).toBe('/release-organization-title')
items.at(1).trigger('click') items.at(1).trigger('click')
expect(openModalSpy).toHaveBeenCalledWith( expect(openModalSpy).toHaveBeenCalledWith('release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8')
'release', 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8'
)
}) })
}) })
@ -504,12 +499,14 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/settings-blocked-users-block') ).toBe('/settings-blocked-users-block')
items.at(1).trigger('click') items.at(1).trigger('click')
expect(wrapper.emitted('block')).toEqual([[ expect(wrapper.emitted('block')).toEqual([
[
{ {
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8', id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
isBlocked: false, isBlocked: false,
} },
]]) ],
])
}) })
it('user can unblock blocked users', () => { it('user can unblock blocked users', () => {
@ -532,12 +529,14 @@ describe('ContentMenu.vue', () => {
.attributes('to'), .attributes('to'),
).toBe('/settings-blocked-users-unblock') ).toBe('/settings-blocked-users-unblock')
items.at(1).trigger('click') items.at(1).trigger('click')
expect(wrapper.emitted('unblock')).toEqual([[ expect(wrapper.emitted('unblock')).toEqual([
[
{ {
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8', id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
isBlocked: true, isBlocked: true,
} },
]]) ],
])
}) })
}) })
}) })