mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
method tests added
This commit is contained in:
parent
e4883b5175
commit
3d3a121dc5
@ -32,12 +32,12 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
mutations = {
|
mutations = {
|
||||||
'modal/SET_OPEN': () => jest.fn(),
|
'modal/SET_OPEN': () => jest.fn(),
|
||||||
}
|
}
|
||||||
getters = {
|
getters = {
|
||||||
'auth/isModerator': () => false,
|
'auth/isModerator': () => false,
|
||||||
'auth/isAdmin': () => false,
|
'auth/isAdmin': () => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const openContentMenu = (values = {}) => {
|
const openContentMenu = (values = {}) => {
|
||||||
@ -48,7 +48,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
},
|
},
|
||||||
mocks,
|
mocks,
|
||||||
store,
|
store,
|
||||||
localVue,
|
localVue,
|
||||||
})
|
})
|
||||||
menuToggle = wrapper.find('.content-menu-trigger')
|
menuToggle = wrapper.find('.content-menu-trigger')
|
||||||
menuToggle.trigger('click')
|
menuToggle.trigger('click')
|
||||||
@ -64,8 +64,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(0).text()).toBe('post.menu.edit')
|
expect(items.at(0).text()).toBe('post.menu.edit')
|
||||||
expect(
|
expect(
|
||||||
@ -81,8 +81,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/post-menu-delete')
|
).toBe('/post-menu-delete')
|
||||||
items.at(1).trigger('click')
|
items.at(1).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('delete')
|
expect(openModalSpy).toHaveBeenCalledWith('delete')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('admin can pin unpinned post', () => {
|
it('admin can pin unpinned post', () => {
|
||||||
@ -103,13 +103,15 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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',
|
{
|
||||||
pinnedBy: null,
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
}
|
pinnedBy: null,
|
||||||
]])
|
},
|
||||||
|
],
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('admin can unpin pinned post', () => {
|
it('admin can unpin pinned post', () => {
|
||||||
@ -130,13 +132,15 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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',
|
{
|
||||||
pinnedBy: 'someone',
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
}
|
pinnedBy: 'someone',
|
||||||
]])
|
},
|
||||||
|
],
|
||||||
|
])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -149,7 +153,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(0).text()).toBe('comment.menu.edit')
|
expect(items.at(0).text()).toBe('comment.menu.edit')
|
||||||
@ -159,8 +163,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/comment-menu-edit')
|
).toBe('/comment-menu-edit')
|
||||||
items.at(0).trigger('click')
|
items.at(0).trigger('click')
|
||||||
expect(wrapper.emitted('showEditCommentMenu')).toEqual([[true]])
|
expect(wrapper.emitted('showEditCommentMenu')).toEqual([[true]])
|
||||||
expect(items.at(1).text()).toBe('comment.menu.delete')
|
expect(items.at(1).text()).toBe('comment.menu.delete')
|
||||||
expect(
|
expect(
|
||||||
items
|
items
|
||||||
@ -168,9 +172,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).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')
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -185,7 +188,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(1)
|
expect(items).toHaveLength(1)
|
||||||
expect(items.at(0).text()).toBe('report.contribution.title')
|
expect(items.at(0).text()).toBe('report.contribution.title')
|
||||||
@ -195,8 +198,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/report-contribution-title')
|
).toBe('/report-contribution-title')
|
||||||
items.at(0).trigger('click')
|
items.at(0).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('anyone who is not owner can report comment', () => {
|
it('anyone who is not owner can report comment', () => {
|
||||||
@ -207,7 +210,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(1)
|
expect(items).toHaveLength(1)
|
||||||
expect(items.at(0).text()).toBe('report.comment.title')
|
expect(items.at(0).text()).toBe('report.comment.title')
|
||||||
@ -217,8 +220,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/report-comment-title')
|
).toBe('/report-comment-title')
|
||||||
items.at(0).trigger('click')
|
items.at(0).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('other users can be reported', () => {
|
it('other users can be reported', () => {
|
||||||
@ -229,7 +232,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(0).text()).toBe('report.user.title')
|
expect(items.at(0).text()).toBe('report.user.title')
|
||||||
@ -239,8 +242,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/report-user-title')
|
).toBe('/report-user-title')
|
||||||
items.at(0).trigger('click')
|
items.at(0).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('other organizations can be reported', () => {
|
it('other organizations can be reported', () => {
|
||||||
@ -251,7 +254,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(1)
|
expect(items).toHaveLength(1)
|
||||||
expect(items.at(0).text()).toBe('report.organization.title')
|
expect(items.at(0).text()).toBe('report.organization.title')
|
||||||
@ -261,8 +264,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/report-organization-title')
|
).toBe('/report-organization-title')
|
||||||
items.at(0).trigger('click')
|
items.at(0).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -278,7 +281,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(1).text()).toBe('disable.contribution.title')
|
expect(items.at(1).text()).toBe('disable.contribution.title')
|
||||||
@ -288,8 +291,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/disable-contribution-title')
|
).toBe('/disable-contribution-title')
|
||||||
items.at(1).trigger('click')
|
items.at(1).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('moderator can disable comments', () => {
|
it('moderator can disable comments', () => {
|
||||||
@ -301,7 +304,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(1).text()).toBe('disable.comment.title')
|
expect(items.at(1).text()).toBe('disable.comment.title')
|
||||||
@ -311,8 +314,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/disable-comment-title')
|
).toBe('/disable-comment-title')
|
||||||
items.at(1).trigger('click')
|
items.at(1).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('moderator can disable users', () => {
|
it('moderator can disable users', () => {
|
||||||
@ -324,7 +327,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(3)
|
expect(items).toHaveLength(3)
|
||||||
expect(items.at(1).text()).toBe('disable.user.title')
|
expect(items.at(1).text()).toBe('disable.user.title')
|
||||||
@ -334,8 +337,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/disable-user-title')
|
).toBe('/disable-user-title')
|
||||||
items.at(1).trigger('click')
|
items.at(1).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('moderator can disable organizations', () => {
|
it('moderator can disable organizations', () => {
|
||||||
@ -347,7 +350,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
// for (var i = 0; i < items.length; i++) { console.log(items.at(i).html()) }
|
// for (var i = 0; i < items.length; i++) { console.log(items.at(i).html()) }
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
@ -358,8 +361,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/disable-organization-title')
|
).toBe('/disable-organization-title')
|
||||||
items.at(1).trigger('click')
|
items.at(1).trigger('click')
|
||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('moderator can release posts', () => {
|
it('moderator can release posts', () => {
|
||||||
@ -371,7 +374,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(1).text()).toBe('release.contribution.title')
|
expect(items.at(1).text()).toBe('release.contribution.title')
|
||||||
@ -381,10 +384,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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', () => {
|
||||||
@ -396,7 +397,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(1).text()).toBe('release.comment.title')
|
expect(items.at(1).text()).toBe('release.comment.title')
|
||||||
@ -406,10 +407,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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', () => {
|
||||||
@ -421,7 +420,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(3)
|
expect(items).toHaveLength(3)
|
||||||
expect(items.at(1).text()).toBe('release.user.title')
|
expect(items.at(1).text()).toBe('release.user.title')
|
||||||
@ -431,10 +430,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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', () => {
|
||||||
@ -446,7 +443,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
openModalSpy = jest.spyOn(wrapper.vm, 'openModal')
|
||||||
let items = wrapper.findAll('.ds-menu-item')
|
let items = wrapper.findAll('.ds-menu-item')
|
||||||
expect(items).toHaveLength(2)
|
expect(items).toHaveLength(2)
|
||||||
expect(items.at(1).text()).toBe('release.organization.title')
|
expect(items.at(1).text()).toBe('release.organization.title')
|
||||||
@ -456,10 +453,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -484,7 +479,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
.attributes('to'),
|
.attributes('to'),
|
||||||
).toBe('/settings')
|
).toBe('/settings')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('user can block other users', () => {
|
it('user can block other users', () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
@ -503,16 +498,18 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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',
|
{
|
||||||
isBlocked: false,
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
}
|
isBlocked: false,
|
||||||
]])
|
},
|
||||||
|
],
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('user can unblock blocked users', () => {
|
it('user can unblock blocked users', () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
@ -531,13 +528,15 @@ describe('ContentMenu.vue', () => {
|
|||||||
.find('span.ds-menu-item-link')
|
.find('span.ds-menu-item-link')
|
||||||
.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',
|
{
|
||||||
isBlocked: true,
|
id: 'd23a4265-f5f7-4e17-9f86-85f714b4b9f8',
|
||||||
}
|
isBlocked: true,
|
||||||
]])
|
},
|
||||||
|
],
|
||||||
|
])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user