Skip to content

OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.

Tighten reset email escaping test

keshav-00550b999de71e9
diff --git a/__tests__/reset-password-email.test.ts b/__tests__/reset-password-email.test.ts
index 323bd48..e629e76 100644
--- a/__tests__/reset-password-email.test.ts
+++ b/__tests__/reset-password-email.test.ts
@@ -30,14 +30,14 @@ describe('sendPasswordResetEmail', () => {
it('escapes interpolated values before building the HTML email', async () => {
await sendPasswordResetEmail({
- name: '<Admin & Co.>',
+ name: '<Admin&Co.>',
resetUrl: 'https://example.com/reset-password?token=a b&next=<script>',
});
expect(sendMailMock).toHaveBeenCalledTimes(1);
const [mailOptions] = sendMailMock.mock.calls[0];
- expect(mailOptions.html).toContain('Hi &lt;Admin,');
+ expect(mailOptions.html).toContain('Hi &lt;Admin&amp;Co.&gt;,');
expect(mailOptions.html).toContain('href="https://example.com/reset-password?token=a%20b&amp;next=%3Cscript%3E"');
expect(mailOptions.html).not.toContain('<script>');
expect(mailOptions.text).toContain('https://example.com/reset-password?token=a%20b&next=%3Cscript%3E');