fix emails

This commit is contained in:
Ulf Gebhardt 2023-04-11 13:01:58 +02:00
parent 3eb95e19b9
commit 9c461da0e7
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
6 changed files with 21 additions and 19 deletions

View File

@ -31,11 +31,11 @@ jest.mock('nodemailer', () => {
}) })
describe('sendEmailTranslated', () => { describe('sendEmailTranslated', () => {
let result: boolean | null let result: Record<string, unknown> | boolean | null
describe('config email is false', () => { describe('config email is false', () => {
beforeEach(() => { beforeEach(async () => {
result = sendEmailTranslated({ result = await sendEmailTranslated({
receiver: { receiver: {
to: 'receiver@mail.org', to: 'receiver@mail.org',
cc: 'support@gradido.net', cc: 'support@gradido.net',
@ -57,9 +57,9 @@ describe('sendEmailTranslated', () => {
}) })
describe('config email is true', () => { describe('config email is true', () => {
beforeEach(() => { beforeEach(async () => {
CONFIG.EMAIL = true CONFIG.EMAIL = true
result = sendEmailTranslated({ result = await sendEmailTranslated({
receiver: { receiver: {
to: 'receiver@mail.org', to: 'receiver@mail.org',
cc: 'support@gradido.net', cc: 'support@gradido.net',
@ -85,7 +85,7 @@ describe('sendEmailTranslated', () => {
}) })
describe('call of "sendEmailTranslated"', () => { describe('call of "sendEmailTranslated"', () => {
it.skip('has expected result', () => { it('has expected result', () => {
expect(result).toMatchObject({ expect(result).toMatchObject({
envelope: { envelope: {
from: 'info@gradido.net', from: 'info@gradido.net',
@ -117,11 +117,11 @@ describe('sendEmailTranslated', () => {
}) })
describe('with email EMAIL_TEST_MODUS true', () => { describe('with email EMAIL_TEST_MODUS true', () => {
beforeEach(() => { beforeEach(async () => {
jest.clearAllMocks() jest.clearAllMocks()
CONFIG.EMAIL = true CONFIG.EMAIL = true
CONFIG.EMAIL_TEST_MODUS = true CONFIG.EMAIL_TEST_MODUS = true
result = sendEmailTranslated({ result = await sendEmailTranslated({
receiver: { receiver: {
to: 'receiver@mail.org', to: 'receiver@mail.org',
cc: 'support@gradido.net', cc: 'support@gradido.net',
@ -133,7 +133,7 @@ describe('sendEmailTranslated', () => {
}) })
}) })
it.skip('call of "sendEmailTranslated" with faked "to"', () => { it('call of "sendEmailTranslated" with faked "to"', () => {
expect(result).toMatchObject({ expect(result).toMatchObject({
envelope: { envelope: {
from: CONFIG.EMAIL_SENDER, from: CONFIG.EMAIL_SENDER,

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import path from 'path' import path from 'path'
import Email from 'email-templates' import Email from 'email-templates'

View File

@ -146,7 +146,7 @@ export class ContributionMessageResolver {
await queryRunner.manager.update(DbContribution, { id: contributionId }, contribution) await queryRunner.manager.update(DbContribution, { id: contributionId }, contribution)
} }
sendAddedContributionMessageEmail({ void sendAddedContributionMessageEmail({
firstName: contribution.user.firstName, firstName: contribution.user.firstName,
lastName: contribution.user.lastName, lastName: contribution.user.lastName,
email: contribution.user.emailContact.email, email: contribution.user.emailContact.email,

View File

@ -424,7 +424,7 @@ export class ContributionResolver {
contribution.amount, contribution.amount,
) )
sendContributionDeletedEmail({ void sendContributionDeletedEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email: user.emailContact.email, email: user.emailContact.email,
@ -518,7 +518,7 @@ export class ContributionResolver {
await queryRunner.commitTransaction() await queryRunner.commitTransaction()
logger.info('creation commited successfuly.') logger.info('creation commited successfuly.')
sendContributionConfirmedEmail({ void sendContributionConfirmedEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email: user.emailContact.email, email: user.emailContact.email,
@ -599,7 +599,7 @@ export class ContributionResolver {
contributionToUpdate.amount, contributionToUpdate.amount,
) )
sendContributionDeniedEmail({ void sendContributionDeniedEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email: user.emailContact.email, email: user.emailContact.email,

View File

@ -149,7 +149,7 @@ export const executeTransaction = async (
} finally { } finally {
await queryRunner.release() await queryRunner.release()
} }
sendTransactionReceivedEmail({ void sendTransactionReceivedEmail({
firstName: recipient.firstName, firstName: recipient.firstName,
lastName: recipient.lastName, lastName: recipient.lastName,
email: recipient.emailContact.email, email: recipient.emailContact.email,
@ -160,7 +160,7 @@ export const executeTransaction = async (
transactionAmount: amount, transactionAmount: amount,
}) })
if (transactionLink) { if (transactionLink) {
sendTransactionLinkRedeemedEmail({ void sendTransactionLinkRedeemedEmail({
firstName: sender.firstName, firstName: sender.firstName,
lastName: sender.lastName, lastName: sender.lastName,
email: sender.emailContact.email, email: sender.emailContact.email,

View File

@ -245,7 +245,7 @@ export class UserResolver {
user.publisherId = publisherId user.publisherId = publisherId
logger.debug('partly faked user', user) logger.debug('partly faked user', user)
sendAccountMultiRegistrationEmail({ void sendAccountMultiRegistrationEmail({
firstName: foundUser.firstName, // this is the real name of the email owner, but just "firstName" would be the name of the new registrant which shall not be passed to the outside firstName: foundUser.firstName, // this is the real name of the email owner, but just "firstName" would be the name of the new registrant which shall not be passed to the outside
lastName: foundUser.lastName, // this is the real name of the email owner, but just "lastName" would be the name of the new registrant which shall not be passed to the outside lastName: foundUser.lastName, // this is the real name of the email owner, but just "lastName" would be the name of the new registrant which shall not be passed to the outside
email, email,
@ -322,7 +322,7 @@ export class UserResolver {
emailContact.emailVerificationCode.toString(), emailContact.emailVerificationCode.toString(),
).replace(/{code}/g, redeemCode ? '/' + redeemCode : '') ).replace(/{code}/g, redeemCode ? '/' + redeemCode : '')
sendAccountActivationEmail({ void sendAccountActivationEmail({
firstName, firstName,
lastName, lastName,
email, email,
@ -385,7 +385,7 @@ export class UserResolver {
logger.info(`optInCode for ${email}=${user.emailContact}`) logger.info(`optInCode for ${email}=${user.emailContact}`)
sendResetPasswordEmail({ void sendResetPasswordEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email, email,
@ -789,7 +789,7 @@ export class UserResolver {
await user.emailContact.save() await user.emailContact.save()
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
sendAccountActivationEmail({ void sendAccountActivationEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email, email,