-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
2 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
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 |
---|---|---|
|
@@ -113,6 +113,39 @@ describe("EmailUploader", () => { | |
expect(mockClient.post).toHaveBeenCalled(); | ||
}); | ||
|
||
it("should apply the outlook paragraph hack", async () => { | ||
const mockClient = { | ||
api: jest.fn().mockReturnThis(), | ||
/// @ts-expect-error: Mocking method | ||
post: jest.fn().mockResolvedValue({ id: "messageId" }), | ||
}; | ||
|
||
/// @ts-expect-error: Mocking property | ||
emailUploader["client"] = mockClient; | ||
|
||
await emailUploader.uploadEmail( | ||
["[email protected]"], | ||
"Subject", | ||
"<p>HTML content</p><p>And some more</p> <p>And some more</p>", | ||
[], | ||
{ cc: [], bcc: [] }, | ||
{ enableOutlookParagraphSpacingHack: true }, | ||
); | ||
|
||
expect(mockClient.api).toHaveBeenCalledWith("/me/messages"); | ||
expect(mockClient.post).toHaveBeenCalledWith({ | ||
subject: "Subject", | ||
toRecipients: [{ emailAddress: { address: "[email protected]" } }], | ||
ccRecipients: [], | ||
bccRecipients: [], | ||
body: { | ||
contentType: "HTML", | ||
content: | ||
"<p>HTML content</p><p><br></p><p>And some more</p><p><br></p><p>And some more</p>", | ||
}, | ||
}); | ||
}); | ||
|
||
it("should upload email successfully with attachments", async () => { | ||
const mockClient = { | ||
api: jest.fn().mockReturnThis(), | ||
|