-
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(productivity-report): additional email headers test (#8540)
Test ability to add custom header to non-transactional email.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: '[email protected]', | ||
optionalHeaders: { | ||
'x-header-name': 'value', | ||
}, | ||
}, | ||
getLogger: noLoggerProvider, | ||
} as unknown as IUnleashConfig); | ||
|
||
const passwordResetMail = await emailService.sendResetMail( | ||
'name', | ||
'[email protected]', | ||
'http://exempla.com', | ||
); | ||
|
||
const productivityMail = await emailService.sendProductivityReportEmail( | ||
'[email protected]', | ||
'customerId', | ||
{ | ||
flagsCreated: 1, | ||
productionUpdates: 2, | ||
health: 99, | ||
}, | ||
); | ||
|
||
expect(passwordResetMail.headers).toBeFalsy(); | ||
|
||
expect(productivityMail.headers).toStrictEqual({ | ||
'x-header-name': 'value', | ||
}); | ||
}); |