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:
Wolfgang Huß 2022-06-20 12:15:26 +02:00
commit a0a9eda0b4
2 changed files with 12 additions and 12 deletions

View File

@ -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()
})

View File

@ -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,