-
-
Notifications
You must be signed in to change notification settings - Fork 10
test(mailer): add missing coverage — Buffer attachment in Resend provider + empty filename #3396
Copy link
Copy link
Closed
Labels
Severity1: confusingBug qualificationBug qualificationTestsAdding missing tests or correcting existingAdding missing tests or correcting existing
Description
Missing test cases
1. Resend provider — Buffer content not tested
File: lib/helpers/mailer/provider.resend.unit.tests.js
The existing test covers string content converted to base64. Buffer content is not tested:
test('should encode Buffer attachment to base64', async () => {
const buffer = Buffer.from('binary data');
await provider.send({ ..., attachments: [{ filename: 'data.bin', content: buffer }] });
expect(mockResend.emails.send).toHaveBeenCalledWith(
expect.objectContaining({
attachments: [{ filename: 'data.bin', content: Buffer.from(buffer).toString('base64') }],
})
);
});2. Mailer index — empty filename not explicitly tested
File: lib/helpers/mailer/tests/mailer.unit.tests.js
validateAttachments correctly rejects filename: '' (via !att.filename) but this case is not explicitly tested:
test('should throw when attachment filename is empty string', async () => {
await expect(sendMail({ ..., attachments: [{ filename: '', content: 'data' }] }))
.rejects.toThrow('Attachment filename must be a non-empty string');
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Severity1: confusingBug qualificationBug qualificationTestsAdding missing tests or correcting existingAdding missing tests or correcting existing