diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts
index 1d562ebe9..666fea994 100644
--- a/backend/src/emails/sendEmailVariants.test.ts
+++ b/backend/src/emails/sendEmailVariants.test.ts
@@ -9,6 +9,7 @@ import {
sendAccountActivationEmail,
sendAccountMultiRegistrationEmail,
sendContributionConfirmedEmail,
+ sendContributionRejectedEmail,
} from './sendEmailVariants'
import { sendEmailTranslated } from './sendEmailTranslated'
@@ -99,7 +100,7 @@ describe('sendEmailVariants', () => {
'you have received a message from Bibi Bloxberg regarding your common good contribution “My contribution.”.',
)
expect(result.originalMessage.html).toContain(
- 'To view and reply to the message, go to the “Community” menu in your Gradido account and click on the “My Contributions to the Common Good” tab!',
+ 'To view and reply to the message, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!',
)
expect(result.originalMessage.html).toContain(
'Link to your account: http://localhost/overview',
@@ -329,4 +330,76 @@ describe('sendEmailVariants', () => {
})
})
})
+
+ describe('sendContributionRejectedEmail', () => {
+ beforeAll(async () => {
+ result = await sendContributionRejectedEmail({
+ firstName: 'Peter',
+ lastName: 'Lustig',
+ email: 'peter@lustig.de',
+ language: 'en',
+ senderFirstName: 'Bibi',
+ senderLastName: 'Bloxberg',
+ contributionMemo: 'My contribution.',
+ })
+ })
+
+ describe('calls "sendEmailTranslated"', () => {
+ it('with expected parameters', () => {
+ expect(sendEmailTranslated).toBeCalledWith({
+ receiver: {
+ to: 'Peter Lustig ',
+ },
+ template: 'contributionRejected',
+ locals: {
+ firstName: 'Peter',
+ lastName: 'Lustig',
+ locale: 'en',
+ senderFirstName: 'Bibi',
+ senderLastName: 'Bloxberg',
+ contributionMemo: 'My contribution.',
+ overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
+ },
+ })
+ })
+
+ it('has expected result', () => {
+ expect(result).toMatchObject({
+ envelope: {
+ from: 'info@gradido.net',
+ to: ['peter@lustig.de'],
+ },
+ message: expect.any(String),
+ originalMessage: expect.objectContaining({
+ to: 'Peter Lustig ',
+ from: 'Gradido (nicht antworten) ',
+ attachments: [],
+ subject: 'Gradido: Your common good contribution was rejected',
+ html: expect.any(String),
+ text: expect.stringContaining('GRADIDO: YOUR COMMON GOOD CONTRIBUTION WAS REJECTED'),
+ }),
+ })
+ expect(result.originalMessage.html).toContain('')
+ expect(result.originalMessage.html).toContain('')
+ expect(result.originalMessage.html).toContain(
+ 'Gradido: Your common good contribution was rejected',
+ )
+ expect(result.originalMessage.html).toContain(
+ '>Gradido: Your common good contribution was rejected',
+ )
+ expect(result.originalMessage.html).toContain('Hello Peter Lustig')
+ expect(result.originalMessage.html).toContain(
+ 'your public good contribution “My contribution.” was rejected by Bibi Bloxberg.',
+ )
+ expect(result.originalMessage.html).toContain(
+ 'To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!',
+ )
+ expect(result.originalMessage.html).toContain(
+ 'Link to your account: http://localhost/overview',
+ )
+ expect(result.originalMessage.html).toContain('Please do not reply to this email!')
+ expect(result.originalMessage.html).toContain('Kind regards,
your Gradido team')
+ })
+ })
+ })
})
diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts
index d5b4cade5..5c9e3250e 100644
--- a/backend/src/graphql/resolver/AdminResolver.test.ts
+++ b/backend/src/graphql/resolver/AdminResolver.test.ts
@@ -39,6 +39,7 @@ import { User } from '@entity/User'
import {
// sendAccountActivationEmail,
sendContributionConfirmedEmail,
+ // sendContributionRejectedEmail,
} from '@/emails/sendEmailVariants'
import Decimal from 'decimal.js-light'
import { Contribution } from '@entity/Contribution'
@@ -58,6 +59,8 @@ jest.mock('@/emails/sendEmailVariants', () => {
sendContributionConfirmedEmail: jest.fn((a) =>
originalModule.sendContributionConfirmedEmail(a),
),
+ // TODO: test the call of …
+ // sendContributionRejectedEmail: jest.fn((a) => originalModule.sendContributionRejectedEmail(a)),
}
})