1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

feat(productivity-report): additional email headers test (#8540)

Test ability to add custom header to non-transactional email.
This commit is contained in:
Tymoteusz Czech 2024-12-09 12:33:25 +01:00 committed by GitHub
parent d40b0795f9
commit e8179d4dd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -177,3 +177,45 @@ test('Can send productivity report email', async () => {
expect(content.text.includes(`localhost/insights`)).toBe(true);
expect(content.text.includes(`localhost/profile`)).toBe(true);
});
test('Should add optional headers to productivity email', async () => {
const emailService = new EmailService({
server: {
unleashUrl: 'http://localhost',
},
email: {
host: 'test',
port: 587,
secure: false,
smtpuser: '',
smtppass: '',
sender: 'noreply@getunleash.ai',
optionalHeaders: {
'x-header-name': 'value',
},
},
getLogger: noLoggerProvider,
} as unknown as IUnleashConfig);
const passwordResetMail = await emailService.sendResetMail(
'name',
'user@example.com',
'http://exempla.com',
);
const productivityMail = await emailService.sendProductivityReportEmail(
'user@user.com',
'customerId',
{
flagsCreated: 1,
productionUpdates: 2,
health: 99,
},
);
expect(passwordResetMail.headers).toBeFalsy();
expect(productivityMail.headers).toStrictEqual({
'x-header-name': 'value',
});
});