Skip to content

Commit 259ebe3

Browse files
committed
test: improve rawContent generation for message mocks
1 parent ab99fba commit 259ebe3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test/mocks/GMailMocks.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ export class GMailMocks {
140140
let headers = `Date: ${msgData.date.toUTCString()}\r\n`
141141
headers += `From: ${msgData.from}\r\n`
142142
headers += `To: ${msgData.to}\r\n`
143-
if (msgData.cc) headers += `Cc: ${msgData.cc}\r\n`
144-
if (msgData.bcc) headers += `Bcc: ${msgData.bcc}\r\n` // Note: BCC usually not in raw headers, but included for testing flexibility
143+
if (msgData.cc && msgData.cc.length > 0)
144+
headers += `Cc: ${msgData.cc}\r\n`
145+
if (msgData.bcc && msgData.bcc.length > 0)
146+
headers += `Bcc: ${msgData.bcc}\r\n` // Note: BCC usually not in raw headers, but included for testing flexibility
145147
headers += `Subject: ${msgData.subject}\r\n`
146148
headers += `Message-ID: <${msgData.id}@mail.gmail.com>\r\n` // Example Message-ID format
147-
if (msgData.replyTo) headers += `Reply-To: ${msgData.replyTo}\r\n`
149+
if (msgData.replyTo && msgData.replyTo.length > 0)
150+
headers += `Reply-To: ${msgData.replyTo}\r\n`
148151
headers += `Content-Type: text/html; charset=utf-8\r\n` // Assuming HTML body for simplicity
149152
return `${headers}\r\n${msgData.body}`
150153
}

0 commit comments

Comments
 (0)