Tests that sendContributionConfirmedEmail is called, removed contributionAmount since it can not be checked.

This commit is contained in:
elweyn 2022-09-14 09:31:39 +02:00
parent 4d493f5a4f
commit 3b810b2add

View File

@ -40,6 +40,8 @@ import Decimal from 'decimal.js-light'
import { Contribution } from '@entity/Contribution'
import { Transaction as DbTransaction } from '@entity/Transaction'
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
import { sendContributionConfirmedEmail } from '@/mailer/sendContributionConfirmedEmail'
import { Any } from '@dbTools/typeorm'
// mock account activation email to avoid console spam
jest.mock('@/mailer/sendAccountActivationEmail', () => {
@ -49,6 +51,14 @@ jest.mock('@/mailer/sendAccountActivationEmail', () => {
}
})
// mock account activation email to avoid console spam
jest.mock('@/mailer/sendContributionConfirmedEmail', () => {
return {
__esModule: true,
sendContributionConfirmedEmail: jest.fn(),
}
})
let mutate: any, query: any, con: any
let testEnv: any
@ -1450,6 +1460,20 @@ describe('AdminResolver', () => {
expect(transaction[0].linkedUserId).toEqual(null)
expect(transaction[0].typeId).toEqual(1)
})
it('calls sendContributionConfirmedEmail', async () => {
expect(sendContributionConfirmedEmail).toBeCalledWith(
expect.objectContaining({
contributionMemo: 'Herzlich Willkommen bei Gradido liebe Bibi!',
overviewURL: 'http://localhost/overview',
recipientEmail: 'bibi@bloxberg.de',
recipientFirstName: 'Bibi',
recipientLastName: 'Bloxberg',
senderFirstName: 'Peter',
senderLastName: 'Lustig',
}),
)
})
})
describe('confirm two creations one after the other quickly', () => {