mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Fix faulty email content tests
This commit is contained in:
parent
560aed056a
commit
b78229b646
@ -17,7 +17,8 @@ jest.mock('./sendEmailTranslated', () => {
|
||||
})
|
||||
|
||||
describe('sendEmailVariants', () => {
|
||||
let result: Record<string, unknown> | null
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let result: any
|
||||
|
||||
describe('sendAccountActivationEmail', () => {
|
||||
beforeAll(async () => {
|
||||
@ -27,7 +28,7 @@ describe('sendEmailVariants', () => {
|
||||
email: 'peter@lustig.de',
|
||||
language: 'en',
|
||||
activationLink: 'http://localhost/checkEmail/6627633878930542284',
|
||||
timeDurationObject: { hours: 24, minutes: 0 },
|
||||
timeDurationObject: { hours: 23, minutes: 30 },
|
||||
})
|
||||
})
|
||||
|
||||
@ -43,7 +44,7 @@ describe('sendEmailVariants', () => {
|
||||
lastName: 'Lustig',
|
||||
locale: 'en',
|
||||
activationLink: 'http://localhost/checkEmail/6627633878930542284',
|
||||
timeDurationObject: { hours: 24, minutes: 0 },
|
||||
timeDurationObject: { hours: 23, minutes: 30 },
|
||||
resendLink: CONFIG.EMAIL_LINK_FORGOTPASSWORD,
|
||||
},
|
||||
})
|
||||
@ -61,29 +62,32 @@ describe('sendEmailVariants', () => {
|
||||
from: 'Gradido (nicht antworten) <info@gradido.net>',
|
||||
attachments: [],
|
||||
subject: 'Gradido: Email Verification',
|
||||
html:
|
||||
expect.stringContaining('<title>Gradido: Email Verification</title>') &&
|
||||
expect.stringContaining('>Gradido: Email Verification</h1>') &&
|
||||
expect.stringContaining(
|
||||
'Your email address has just been registered with Gradido.',
|
||||
) &&
|
||||
expect.stringContaining(
|
||||
'Please click on this link to complete the registration and activate your Gradido account:',
|
||||
) &&
|
||||
expect.stringContaining(
|
||||
'<a href="http://localhost/checkEmail/6627633878930542284">http://localhost/checkEmail/6627633878930542284</a>',
|
||||
) &&
|
||||
expect.stringContaining('or copy the link above into your browser window.') &&
|
||||
expect.stringContaining(
|
||||
'The link has a validity of {hours} hours and {minutes} minutes. If the validity of the link has already expired, you can have a new link sent to you here by entering your email address:',
|
||||
) &&
|
||||
expect.stringContaining(
|
||||
`<a href="${CONFIG.EMAIL_LINK_FORGOTPASSWORD}">${CONFIG.EMAIL_LINK_FORGOTPASSWORD}</a>`,
|
||||
) &&
|
||||
expect.stringContaining('Sincerely yours,<br><span>your Gradido team'),
|
||||
html: expect.any(String),
|
||||
text: expect.stringContaining('GRADIDO: EMAIL VERIFICATION'),
|
||||
}),
|
||||
})
|
||||
expect(result.originalMessage.html).toContain('<title>Gradido: Email Verification</title>')
|
||||
expect(result.originalMessage.html).toContain('>Gradido: Email Verification</h1>')
|
||||
expect(result.originalMessage.html).toContain('Hello Peter Lustig')
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'Your email address has just been registered with Gradido.',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'Please click on this link to complete the registration and activate your Gradido account:',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'<a href="http://localhost/checkEmail/6627633878930542284">http://localhost/checkEmail/6627633878930542284</a>',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'or copy the link above into your browser window.',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'The link has a validity of 23 hours and 30 minutes. If the validity of the link has already expired, you can have a new link sent to you here by entering your email address:',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
`<a href="${CONFIG.EMAIL_LINK_FORGOTPASSWORD}">${CONFIG.EMAIL_LINK_FORGOTPASSWORD}</a>`,
|
||||
)
|
||||
expect(result.originalMessage.html).toContain('Sincerely yours,<br><span>your Gradido team')
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -126,31 +130,36 @@ describe('sendEmailVariants', () => {
|
||||
from: 'Gradido (nicht antworten) <info@gradido.net>',
|
||||
attachments: [],
|
||||
subject: 'Gradido: Try To Register Again With Your Email',
|
||||
html:
|
||||
expect.stringContaining(
|
||||
'<title>Gradido: Try To Register Again With Your Email</title>',
|
||||
) &&
|
||||
expect.stringContaining('>Gradido: Try To Register Again With Your Email</h1>') &&
|
||||
expect.stringContaining(
|
||||
'Your email address has just been used again to register an account with Gradido.',
|
||||
) &&
|
||||
expect.stringContaining(
|
||||
'However, an account already exists for your email address.',
|
||||
) &&
|
||||
expect.stringContaining(
|
||||
'Please click on the following link if you have forgotten your password:',
|
||||
) &&
|
||||
expect.stringContaining(
|
||||
`<a href="${CONFIG.EMAIL_LINK_FORGOTPASSWORD}">${CONFIG.EMAIL_LINK_FORGOTPASSWORD}</a>`,
|
||||
) &&
|
||||
expect.stringContaining('or copy the link above into your browser window.') &&
|
||||
expect.stringContaining(
|
||||
'If you are not the one who tried to register again, please contact our support:',
|
||||
) &&
|
||||
expect.stringContaining('Sincerely yours,<br><span>your Gradido team'),
|
||||
html: expect.any(String),
|
||||
text: expect.stringContaining('GRADIDO: TRY TO REGISTER AGAIN WITH YOUR EMAIL'),
|
||||
}),
|
||||
})
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'<title>Gradido: Try To Register Again With Your Email</title>',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'>Gradido: Try To Register Again With Your Email</h1>',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain('Hello Peter Lustig')
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'Your email address has just been used again to register an account with Gradido.',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'However, an account already exists for your email address.',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'Please click on the following link if you have forgotten your password:',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
`<a href="${CONFIG.EMAIL_LINK_FORGOTPASSWORD}">${CONFIG.EMAIL_LINK_FORGOTPASSWORD}</a>`,
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'or copy the link above into your browser window.',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain(
|
||||
'If you are not the one who tried to register again, please contact our support:',
|
||||
)
|
||||
expect(result.originalMessage.html).toContain('Sincerely yours,<br><span>your Gradido team')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user