From b12cc3f57d407ec748d0fd243215a3464ccc4b39 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 15 May 2023 21:40:57 +0200 Subject: [PATCH] set support email in email template tests --- backend/src/emails/sendEmailVariants.test.ts | 96 +++++++++----------- 1 file changed, 41 insertions(+), 55 deletions(-) diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts index e3655a405..d8b60279a 100644 --- a/backend/src/emails/sendEmailVariants.test.ts +++ b/backend/src/emails/sendEmailVariants.test.ts @@ -34,7 +34,8 @@ let testEnv: { // TODO // when https://gdd.gradido.net/img/gradido-email-header.jpg is on production, // replace this URL by https://gdd.gradido.net/img/brand/gradido-email-header.png -const headerImageURL = 'https://cdn.discordapp.com/attachments/913740067208564736/1107629904306110595/Kopf-Grafik.png' +const headerImageURL = + 'https://cdn.discordapp.com/attachments/913740067208564736/1107629904306110595/Kopf-Grafik.png' beforeAll(async () => { testEnv = await testEnvironment(logger, localization) @@ -85,7 +86,7 @@ describe('sendEmailVariants', () => { senderLastName: 'Bloxberg', contributionMemo: 'My contribution.', overviewURL: CONFIG.EMAIL_LINK_OVERVIEW, - supportEmail: CONFIG.COMMUNITY_SUPPORT_MAIL, + supportEmail: 'support@gradido.net', communityURL: CONFIG.COMMUNITY_URL, }, }) @@ -112,9 +113,7 @@ describe('sendEmailVariants', () => { }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -232,9 +231,7 @@ describe('sendEmailVariants', () => { }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -265,10 +262,10 @@ describe('sendEmailVariants', () => { ) expect(result.originalMessage.html).toContain('>Request new valid link') expect(result.originalMessage.html).toContain( - 'The link has a validity of 23 hours and 30 minutes.' + 'The link has a validity of 23 hours and 30 minutes.', ) expect(result.originalMessage.html).toContain( - 'If the validity of the link has already expired, you can have a new link sent to you here.' + 'If the validity of the link has already expired, you can have a new link sent to you here.', ) expect(result.originalMessage.html).toContain('>New link') expect(result.originalMessage.html).toContain(`href="${CONFIG.EMAIL_LINK_FORGOTPASSWORD}"`) @@ -357,11 +354,9 @@ describe('sendEmailVariants', () => { }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) - + it('has correct doctype and language set', () => { expect(result.originalMessage.html).toContain('') expect(result.originalMessage.html).toContain(' { 'However, an account already exists for your email address.', ) }) - + it('has correct CTA block', () => { expect(result.originalMessage.html).toContain('>Reset password') expect(result.originalMessage.html).toContain( @@ -389,12 +384,14 @@ describe('sendEmailVariants', () => { `reset') - expect(result.originalMessage.html).toContain('Or copy the link into your browser window.') expect(result.originalMessage.html).toContain( - `>${CONFIG.EMAIL_LINK_FORGOTPASSWORD}`, + 'Or copy the link into your browser window.', ) + expect(result.originalMessage.html).toContain(`>${CONFIG.EMAIL_LINK_FORGOTPASSWORD}`) expect(result.originalMessage.html).toContain('>Contact support') - expect(result.originalMessage.html).toContain('If you did not try to register again, please contact our support:') + expect(result.originalMessage.html).toContain( + 'If you did not try to register again, please contact our support:', + ) expect(result.originalMessage.html).toContain('href="mailto:support@gradido.net"') expect(result.originalMessage.html).toContain('>support@gradido.net') }) @@ -403,10 +400,12 @@ describe('sendEmailVariants', () => { expect(result.originalMessage.html).toContain('Kind regards,your Gradido team') }) - + it('has correct footer', () => { expect(result.originalMessage.html).toContain('href="https://t.me/GradidoGruppe"') - expect(result.originalMessage.html).toContain('href="https://www.youtube.com/c/GradidoNet"') + expect(result.originalMessage.html).toContain( + 'href="https://www.youtube.com/c/GradidoNet"', + ) expect(result.originalMessage.html).toContain('href="https://twitter.com/gradido"') expect(result.originalMessage.html).toContain( 'href="https://www.facebook.com/groups/Gradido/"', @@ -486,17 +485,13 @@ describe('sendEmailVariants', () => { attachments: [], subject: 'Gradido: Your contribution to the common good was confirmed', html: expect.any(String), - text: expect.stringContaining( - 'YOUR CONTRIBUTION TO THE COMMON GOOD WAS CONFIRMED', - ), + text: expect.stringContaining('YOUR CONTRIBUTION TO THE COMMON GOOD WAS CONFIRMED'), }), }) }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -505,7 +500,9 @@ describe('sendEmailVariants', () => { }) it('has correct heading, salutation, and text', () => { - expect(result.originalMessage.html).toContain('>Your contribution to the common good was confirmed') + expect(result.originalMessage.html).toContain( + '>Your contribution to the common good was confirmed', + ) expect(result.originalMessage.html).toContain('Hello Peter Lustig,') expect(result.originalMessage.html).toContain( 'Your common good contribution “My contribution.” has just been approved by Bibi Bloxberg. Your Gradido account has been credited with 23.54 GDD.', @@ -616,11 +613,9 @@ describe('sendEmailVariants', () => { }), }) }) - + it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -719,7 +714,7 @@ describe('sendEmailVariants', () => { }) }) }) - + describe('result', () => { it('is the expected object', () => { expect(result).toMatchObject({ @@ -740,9 +735,7 @@ describe('sendEmailVariants', () => { }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -759,7 +752,7 @@ describe('sendEmailVariants', () => { 'Your common good contribution “My contribution.” was deleted by Bibi Bloxberg.', ) }) - + it('has correct CTA block', () => { expect(result.originalMessage.html).toContain('>Contribution details') expect(result.originalMessage.html).toContain( @@ -775,7 +768,7 @@ describe('sendEmailVariants', () => { ) expect(result.originalMessage.html).toContain('Please do not reply to this email.') }) - + it('has correct greating formula', () => { expect(result.originalMessage.html).toContain('Kind regards,your Gradido team') @@ -808,7 +801,6 @@ describe('sendEmailVariants', () => { ' { }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -882,12 +872,10 @@ describe('sendEmailVariants', () => { 'You, or someone else, requested a password reset for this account.', ) }) - + it('has correct CTA block', () => { expect(result.originalMessage.html).toContain('>Reset password') - expect(result.originalMessage.html).toContain( - 'If it was you, please click here.', - ) + expect(result.originalMessage.html).toContain('If it was you, please click here.') expect(result.originalMessage.html).toContain( ' { ) expect(result.originalMessage.html).toContain('>Request new valid link') expect(result.originalMessage.html).toContain( - 'The link has a validity of 23 hours and 30 minutes.' + 'The link has a validity of 23 hours and 30 minutes.', ) expect(result.originalMessage.html).toContain( - 'If the validity of the link has already expired, you can have a new link sent to you here.' + 'If the validity of the link has already expired, you can have a new link sent to you here.', ) expect(result.originalMessage.html).toContain('>New link') expect(result.originalMessage.html).toContain(`href="${CONFIG.EMAIL_LINK_FORGOTPASSWORD}"`) @@ -1001,9 +989,7 @@ describe('sendEmailVariants', () => { }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -1127,9 +1113,7 @@ describe('sendEmailVariants', () => { }) it('has correct header', () => { - expect(result.originalMessage.html).toContain( - `src="${headerImageURL}"`, - ) + expect(result.originalMessage.html).toContain(`src="${headerImageURL}"`) }) it('has correct doctype and language set', () => { @@ -1138,13 +1122,15 @@ describe('sendEmailVariants', () => { }) it('has correct heading, salutation, and text', () => { - expect(result.originalMessage.html).toContain('>Bibi Bloxberg has sent you 37.40 Gradido') + expect(result.originalMessage.html).toContain( + '>Bibi Bloxberg has sent you 37.40 Gradido', + ) expect(result.originalMessage.html).toContain('Hello Peter Lustig,') expect(result.originalMessage.html).toContain( 'You have just received 37.40 GDD from Bibi Bloxberg (bibi@bloxberg.de).', ) }) - + it('has correct CTA block', () => { expect(result.originalMessage.html).toContain('>Transaction details') expect(result.originalMessage.html).toContain(