mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2740 from gradido/2689-test-email-send-deny-deleted-contribution
test(backend): add tests that ``sendContributionDeleted`` and ``sendContributionDenied`` are called
This commit is contained in:
commit
6300e08de0
@ -24,7 +24,11 @@ import {
|
|||||||
listContributions,
|
listContributions,
|
||||||
adminListAllContributions,
|
adminListAllContributions,
|
||||||
} from '@/seeds/graphql/queries'
|
} from '@/seeds/graphql/queries'
|
||||||
import { sendContributionConfirmedEmail } from '@/emails/sendEmailVariants'
|
import {
|
||||||
|
sendContributionConfirmedEmail,
|
||||||
|
sendContributionDeletedEmail,
|
||||||
|
sendContributionDeniedEmail,
|
||||||
|
} from '@/emails/sendEmailVariants'
|
||||||
import {
|
import {
|
||||||
cleanDB,
|
cleanDB,
|
||||||
resetToken,
|
resetToken,
|
||||||
@ -50,21 +54,7 @@ import { ContributionListResult } from '@model/Contribution'
|
|||||||
import { ContributionStatus } from '@enum/ContributionStatus'
|
import { ContributionStatus } from '@enum/ContributionStatus'
|
||||||
import { Order } from '@enum/Order'
|
import { Order } from '@enum/Order'
|
||||||
|
|
||||||
// mock account activation email to avoid console spam
|
jest.mock('@/emails/sendEmailVariants')
|
||||||
jest.mock('@/emails/sendEmailVariants', () => {
|
|
||||||
const originalModule = jest.requireActual('@/emails/sendEmailVariants')
|
|
||||||
return {
|
|
||||||
__esModule: true,
|
|
||||||
...originalModule,
|
|
||||||
// TODO: test the call of …
|
|
||||||
// sendAccountActivationEmail: jest.fn((a) => originalModule.sendAccountActivationEmail(a)),
|
|
||||||
sendContributionConfirmedEmail: jest.fn((a) =>
|
|
||||||
originalModule.sendContributionConfirmedEmail(a),
|
|
||||||
),
|
|
||||||
// TODO: test the call of …
|
|
||||||
// sendContributionRejectedEmail: jest.fn((a) => originalModule.sendContributionRejectedEmail(a)),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
let mutate: any, query: any, con: any
|
let mutate: any, query: any, con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
@ -829,6 +819,18 @@ describe('ContributionResolver', () => {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('calls sendContributionDeniedEmail', async () => {
|
||||||
|
expect(sendContributionDeniedEmail).toBeCalledWith({
|
||||||
|
firstName: 'Bibi',
|
||||||
|
lastName: 'Bloxberg',
|
||||||
|
email: 'bibi@bloxberg.de',
|
||||||
|
language: 'de',
|
||||||
|
senderFirstName: 'Peter',
|
||||||
|
senderLastName: 'Lustig',
|
||||||
|
contributionMemo: 'Test contribution to deny',
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -2384,6 +2386,18 @@ describe('ContributionResolver', () => {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('calls sendContributionDeletedEmail', async () => {
|
||||||
|
expect(sendContributionDeletedEmail).toBeCalledWith({
|
||||||
|
firstName: 'Peter',
|
||||||
|
lastName: 'Lustig',
|
||||||
|
email: 'peter@lustig.de',
|
||||||
|
language: 'de',
|
||||||
|
senderFirstName: 'Peter',
|
||||||
|
senderLastName: 'Lustig',
|
||||||
|
contributionMemo: 'Das war leider zu Viel!',
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('creation already confirmed', () => {
|
describe('creation already confirmed', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user