From 973630e5fbd952fd0e172b160c1f44efb3ba6407 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 13 Feb 2023 13:20:31 +0100 Subject: [PATCH] also test the emeil going out --- .../src/graphql/resolver/UserResolver.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 36a22c386..19eb04b34 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -1820,6 +1820,28 @@ describe('UserResolver', () => { ) }) + it('sends an account activation email', async () => { + const userConatct = await UserContact.findOneOrFail( + { email: 'bibi@bloxberg.de' }, + { relations: ['user'] }, + ) + const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( + /{optin}/g, + userConatct.emailVerificationCode.toString(), + ).replace(/{code}/g, '') + expect(sendAccountActivationEmail).toBeCalledWith({ + firstName: 'Bibi', + lastName: 'Bloxberg', + email: 'bibi@bloxberg.de', + language: 'de', + activationLink, + timeDurationObject: expect.objectContaining({ + hours: expect.any(Number), + minutes: expect.any(Number), + }), + }) + }) + it('stores the ADMIN_SEND_CONFIRMATION_EMAIL event in the database', async () => { const userConatct = await UserContact.findOneOrFail( { email: 'bibi@bloxberg.de' },