Yicong-Huang commented on code in PR #5460:
URL: https://github.com/apache/texera/pull/5460#discussion_r3369790267
##########
frontend/src/app/common/service/gmail/gmail.service.spec.ts:
##########
@@ -63,4 +64,76 @@ describe("GmailService", () => {
expect(notificationSpy.error).toHaveBeenCalledWith("Failed to send email.
Please try again or contact admin.");
expect(notificationSpy.success).not.toHaveBeenCalled();
});
+
+ it("sends the correct PUT body for sendEmail with an explicit receiver", ()
=> {
+ service.sendEmail("subj", "body", "[email protected]");
+
+ const req = httpTestingController.expectOne(r =>
r.url.endsWith("/gmail/send") && r.method === "PUT");
+ expect(req.request.body).toEqual({ receiver: "[email protected]", subject:
"subj", content: "body" });
+ req.flush(null);
+ });
+
+ it("defaults the receiver to an empty string when it is omitted", () => {
+ service.sendEmail("subj", "body");
+
+ const req = httpTestingController.expectOne(r =>
r.url.endsWith("/gmail/send") && r.method === "PUT");
+ expect(req.request.body).toEqual({ receiver: "", subject: "subj", content:
"body" });
+ req.flush(null);
+ });
Review Comment:
is this a bug or intentional? if the email receiver is empty, can an email
be sent?
if it is a bug, please create an issue to follow up on fixing it. we can pin
test as it is first, then in the fix, we can see it updates the test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]