mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Test that when an admin user create a contribution in FE he can not delete it in admin interface.
This commit is contained in:
parent
e7b5400db2
commit
6df8b9a83f
@ -16,6 +16,7 @@ import {
|
||||
setUserRole,
|
||||
deleteUser,
|
||||
unDeleteUser,
|
||||
createContribution,
|
||||
adminCreateContribution,
|
||||
adminCreateContributions,
|
||||
adminUpdateContribution,
|
||||
@ -77,6 +78,7 @@ afterAll(async () => {
|
||||
let admin: User
|
||||
let user: User
|
||||
let creation: Contribution | void
|
||||
let result: any
|
||||
|
||||
describe('AdminResolver', () => {
|
||||
describe('set user role', () => {
|
||||
@ -1360,6 +1362,38 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('admin deletes own user contribution', () => {
|
||||
beforeAll(async () => {
|
||||
await query({
|
||||
query: login,
|
||||
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||
})
|
||||
result = await mutate({
|
||||
mutation: createContribution,
|
||||
variables: {
|
||||
amount: 100.0,
|
||||
memo: 'Test env contribution',
|
||||
creationDate: new Date().toString(),
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it('throws an error', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: adminDeleteContribution,
|
||||
variables: {
|
||||
id: result.data.createContribution.id,
|
||||
},
|
||||
}),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
errors: [new GraphQLError('Own contribution can not be deleted as admin')],
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('creation id does exist', () => {
|
||||
it('returns true', async () => {
|
||||
await expect(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user