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

View File

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

View File

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

View File

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

View File

@ -245,7 +245,7 @@ export class UserResolver {
user.publisherId = publisherId
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
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,
@ -322,7 +322,7 @@ export class UserResolver {
emailContact.emailVerificationCode.toString(),
).replace(/{code}/g, redeemCode ? '/' + redeemCode : '')
sendAccountActivationEmail({
void sendAccountActivationEmail({
firstName,
lastName,
email,
@ -385,7 +385,7 @@ export class UserResolver {
logger.info(`optInCode for ${email}=${user.emailContact}`)
sendResetPasswordEmail({
void sendResetPasswordEmail({
firstName: user.firstName,
lastName: user.lastName,
email,
@ -789,7 +789,7 @@ export class UserResolver {
await user.emailContact.save()
// eslint-disable-next-line @typescript-eslint/no-unused-vars
sendAccountActivationEmail({
void sendAccountActivationEmail({
firstName: user.firstName,
lastName: user.lastName,
email,