mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Add tests that emails are send for denied and deleted contributions.
This commit is contained in:
parent
bf9dff7d59
commit
cc6d781c22
@ -25,7 +25,11 @@ import {
|
||||
listContributions,
|
||||
adminListAllContributions,
|
||||
} from '@/seeds/graphql/queries'
|
||||
import { sendContributionConfirmedEmail } from '@/emails/sendEmailVariants'
|
||||
import {
|
||||
sendContributionConfirmedEmail,
|
||||
sendContributionDeletedEmail,
|
||||
sendContributionDeniedEmail,
|
||||
} from '@/emails/sendEmailVariants'
|
||||
import {
|
||||
cleanDB,
|
||||
resetToken,
|
||||
@ -57,13 +61,11 @@ jest.mock('@/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)),
|
||||
sendContributionDeletedEmail: jest.fn((a) => originalModule.sendContributionDeletedEmail(a)),
|
||||
sendContributionDeniedEmail: jest.fn((a) => originalModule.sendContributionDeniedEmail(a)),
|
||||
}
|
||||
})
|
||||
|
||||
@ -830,6 +832,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',
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -2461,6 +2475,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', () => {
|
||||
|
||||
@ -466,7 +466,7 @@ export class ContributionResolver {
|
||||
|
||||
await EVENT_ADMIN_CONTRIBUTION_DELETE(contribution.userId, contribution.id, contribution.amount)
|
||||
|
||||
sendContributionDeletedEmail({
|
||||
await sendContributionDeletedEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user