test(email): cover customNote escaping + text-path for mentorship templates

This commit is contained in:
Matt
2026-06-01 16:28:32 +02:00
parent a973b1316c
commit 9d3ed1cc64

View File

@@ -16,13 +16,17 @@ describe('getMentorBulkAssignmentTemplate', () => {
},
],
'https://x/mentor',
'Please reach out this week.',
'Reach out <b>now</b> & soon',
)
expect(t.html).toContain('bob@team.com')
expect(t.html).toContain('How to mentor on MOPC')
expect(t.html).toContain('Please reach out this week.')
// The admin-supplied custom note must be HTML-escaped in the HTML body.
expect(t.html).toContain('&lt;b&gt;')
expect(t.html).not.toContain('<b>now</b>')
expect(t.text).toContain('bob@team.com')
expect(t.text).toContain('How to mentor on MOPC')
// The plain-text body keeps the raw note unescaped.
expect(t.text).toContain('Reach out <b>now</b> & soon')
})
it('renders without team members or note (backward compatible)', () => {
@@ -51,6 +55,10 @@ describe('getTeamMentorIntroductionTemplate', () => {
expect(t.html).toContain('carol@team.com')
expect(t.html).toContain('Working with your mentor')
expect(t.html).toContain('Welcome aboard!')
// Mirror coverage on the plain-text path.
expect(t.text).toContain('alice@mentor.com')
expect(t.text).toContain('carol@team.com')
expect(t.text).toContain('Welcome aboard!')
})
it('renders without teammates or note (backward compatible)', () => {