test that moderator cannot change roles

This commit is contained in:
Moriz Wahl 2023-07-24 16:04:03 +02:00
parent 1d2bb05069
commit 2de0b620c0

View File

@ -296,7 +296,6 @@ describe('ChangeUserRoleFormular', () => {
describe('user has role "moderator"', () => {
beforeEach(() => {
jest.clearAllMocks()
apolloMutateMock.mockResolvedValue({
data: {
setUserRole: null,
@ -650,5 +649,23 @@ describe('ChangeUserRoleFormular', () => {
})
})
})
describe('authenticated user is MODERATOR', () => {
beforeEach(() => {
mocks.$store.state.moderator.roles = ['MODERATOR']
})
it('displays text with role', () => {
expect(wrapper.text()).toBe('userRole.selectRoles.admin')
})
it('has no role select', () => {
expect(wrapper.find('select.role-select').exists()).toBe(false)
})
it('has no button', () => {
expect(wrapper.find('button.btn.btn-dange').exists()).toBe(false)
})
})
})
})