-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail.test.js
More file actions
32 lines (27 loc) · 923 Bytes
/
email.test.js
File metadata and controls
32 lines (27 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import orchestrator from "tests/orchestrator";
import email from "infra/email";
beforeAll(async () => {
await orchestrator.waitForAllServices();
});
describe("infra/email.js", () => {
test("send()", async () => {
await orchestrator.deleteAllEmails();
await email.send({
from: "Isaac <isaac@isaacmuniz.pro>",
to: "muniz@isaacmuniz.pro",
subject: "Test subject",
text: "Body test.",
});
await email.send({
from: "Isaac <last.from@isaacmuniz.pro>",
to: "last.to@isaacmuniz.pro",
subject: "Last email sent",
text: "Last email body.",
});
const lastEmail = await orchestrator.getLastEmail();
expect(lastEmail.sender).toBe("<last.from@isaacmuniz.pro>");
expect(lastEmail.recipients[0]).toBe("<last.to@isaacmuniz.pro>");
expect(lastEmail.subject).toBe("Last email sent");
expect(lastEmail.text).toBe("Last email body.\n");
});
});