mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch '1881-set-role-in-admin-interface' of github.com:gradido/gradido into 1881-set-role-in-admin-interface
This commit is contained in:
commit
a0a9eda0b4
@ -52,7 +52,7 @@ describe('ChangeUserRoleFormular', () => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('a DIV element with the class.delete-user-formular', () => {
|
||||
it('has a DIV element with the class.delete-user-formular', () => {
|
||||
expect(wrapper.find('.change-user-role-formular').exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
@ -72,7 +72,7 @@ describe('ChangeUserRoleFormular', () => {
|
||||
expect(wrapper.text()).toContain('userRole.notChangeYourSelf')
|
||||
})
|
||||
|
||||
it('role select is disabled', () => {
|
||||
it('has role select disabled', () => {
|
||||
expect(wrapper.find('select[disabled="disabled"]').exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
@ -104,7 +104,7 @@ describe('ChangeUserRoleFormular', () => {
|
||||
expect(wrapper.find('select.role-select').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('role select is enabled', () => {
|
||||
it('has role select enabled', () => {
|
||||
expect(wrapper.find('select.role-select[disabled="disabled"]').exists()).toBe(false)
|
||||
})
|
||||
|
||||
@ -138,13 +138,13 @@ describe('ChangeUserRoleFormular', () => {
|
||||
rolesToSelect = wrapper.find('select.role-select').findAll('option')
|
||||
})
|
||||
|
||||
it('select is set to "usual user"', () => {
|
||||
it('has selected option set to "usual user"', () => {
|
||||
expect(wrapper.find('select.role-select').element.value).toBe('user')
|
||||
})
|
||||
|
||||
describe('change select to', () => {
|
||||
describe('same role', () => {
|
||||
it('not calling the API', () => {
|
||||
it('does not call the API', () => {
|
||||
rolesToSelect.at(0).setSelected()
|
||||
expect(apolloMutateMock).not.toHaveBeenCalled()
|
||||
})
|
||||
@ -204,13 +204,13 @@ describe('ChangeUserRoleFormular', () => {
|
||||
rolesToSelect = wrapper.find('select.role-select').findAll('option')
|
||||
})
|
||||
|
||||
it('select is set to "admin"', () => {
|
||||
it('has selected option set to "admin"', () => {
|
||||
expect(wrapper.find('select.role-select').element.value).toBe('admin')
|
||||
})
|
||||
|
||||
describe('change select to', () => {
|
||||
describe('same role', () => {
|
||||
it('not calling the API', () => {
|
||||
it('does not call the API', () => {
|
||||
rolesToSelect.at(1).setSelected()
|
||||
expect(apolloMutateMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@ -141,7 +141,7 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
|
||||
describe('user gets new role', () => {
|
||||
describe('is admin', () => {
|
||||
describe('to admin', () => {
|
||||
it('returns date string', async () => {
|
||||
const result = await mutate({
|
||||
mutation: setUserRole,
|
||||
@ -158,8 +158,8 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('is usual user', () => {
|
||||
it('returns string', async () => {
|
||||
describe('to usual user', () => {
|
||||
it('returns null', async () => {
|
||||
await expect(
|
||||
mutate({ mutation: setUserRole, variables: { userId: user.id, isAdmin: false } }),
|
||||
).resolves.toEqual(
|
||||
@ -188,7 +188,7 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
|
||||
describe('user has already role to be set', () => {
|
||||
describe('is admin', () => {
|
||||
describe('to admin', () => {
|
||||
it('throws an error', async () => {
|
||||
await mutate({
|
||||
mutation: setUserRole,
|
||||
@ -204,7 +204,7 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('is usual user', () => {
|
||||
describe('to usual user', () => {
|
||||
it('throws an error', async () => {
|
||||
await mutate({
|
||||
mutation: setUserRole,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user