mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Change rejected to deny, add error test for denyContribution & remove TODO comment.
This commit is contained in:
parent
2291cc813e
commit
57222d07c4
@ -76,7 +76,7 @@ describe('CreationConfirm', () => {
|
|||||||
|
|
||||||
const listUnconfirmedContributionsMock = jest.fn()
|
const listUnconfirmedContributionsMock = jest.fn()
|
||||||
const adminDeleteContributionMock = jest.fn()
|
const adminDeleteContributionMock = jest.fn()
|
||||||
const adminRejectContributionMock = jest.fn()
|
const adminDenyContributionMock = jest.fn()
|
||||||
const confirmContributionMock = jest.fn()
|
const confirmContributionMock = jest.fn()
|
||||||
|
|
||||||
mockClient.setRequestHandler(
|
mockClient.setRequestHandler(
|
||||||
@ -93,7 +93,9 @@ describe('CreationConfirm', () => {
|
|||||||
|
|
||||||
mockClient.setRequestHandler(
|
mockClient.setRequestHandler(
|
||||||
denyContribution,
|
denyContribution,
|
||||||
adminRejectContributionMock.mockResolvedValue({ data: { denyContribution: true } }),
|
adminDenyContributionMock
|
||||||
|
.mockRejectedValueOnce({ message: 'Ouch!' })
|
||||||
|
.mockResolvedValue({ data: { denyContribution: true } }),
|
||||||
)
|
)
|
||||||
|
|
||||||
mockClient.setRequestHandler(
|
mockClient.setRequestHandler(
|
||||||
@ -251,6 +253,20 @@ describe('CreationConfirm', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('deny creation with error', () => {
|
||||||
|
let spy
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm')
|
||||||
|
spy.mockImplementation(() => Promise.resolve('some value'))
|
||||||
|
await wrapper.findAll('tr').at(1).findAll('button').at(0).trigger('click')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('toasts an error message', () => {
|
||||||
|
expect(toastErrorSpy).toBeCalledWith('Ouchhh!')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('deny creation with success', () => {
|
describe('deny creation with success', () => {
|
||||||
let spy
|
let spy
|
||||||
|
|
||||||
@ -266,7 +282,7 @@ describe('CreationConfirm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('calls the adminDeleteContribution mutation', () => {
|
it('calls the adminDeleteContribution mutation', () => {
|
||||||
expect(adminRejectContributionMock).toBeCalledWith({ id: 1 })
|
expect(adminDenyContributionMock).toBeCalledWith({ id: 1 })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('commits openCreationsMinus to store', () => {
|
it('commits openCreationsMinus to store', () => {
|
||||||
@ -286,7 +302,7 @@ describe('CreationConfirm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('does not call the adminDeleteContribution mutation', () => {
|
it('does not call the adminDeleteContribution mutation', () => {
|
||||||
expect(adminRejectContributionMock).not.toBeCalled()
|
expect(adminDenyContributionMock).not.toBeCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -732,9 +732,6 @@ export class ContributionResolver {
|
|||||||
confirmedAt: IsNull(),
|
confirmedAt: IsNull(),
|
||||||
deniedBy: IsNull(),
|
deniedBy: IsNull(),
|
||||||
})
|
})
|
||||||
// TODO: Check
|
|
||||||
// - contribution exists
|
|
||||||
// - state has accept one
|
|
||||||
if (!contributionToUpdate) {
|
if (!contributionToUpdate) {
|
||||||
logger.error(`Contribution not found for given id: ${id}`)
|
logger.error(`Contribution not found for given id: ${id}`)
|
||||||
throw new Error(`Contribution not found for given id.`)
|
throw new Error(`Contribution not found for given id.`)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user