This commit is contained in:
Leandro Facchinetti 2021-03-13 11:23:02 +00:00
parent 534d06e0d8
commit 448cc22c6a
1 changed files with 27 additions and 1 deletions

View File

@ -30,7 +30,7 @@ afterAll(() => {
emailServer.close();
});
test("create feed", async () => {
test("Create feed", async () => {
const createResponseBody = (
await webClient.post("", { form: { name: "A newsletter" } })
).body;
@ -53,6 +53,32 @@ test("create feed", async () => {
expect(alternateResponse.body).toMatch(`Enjoy your readings!`);
});
describe("Receive email", () => {
test("HTML content", async () => {
const feedReference = (
await webClient.post("", { form: { name: "A newsletter" } })
).body.match(/\/feeds\/([a-z0-9]{16})\.xml/)![1];
const feedBefore = (await webClient.get(`feeds/${feedReference}.xml`)).body;
await emailClient.sendMail({
from: "publisher@example.com",
to: `${feedReference}@$localhost`,
subject: "A subject",
html: html`<p>Some HTML content</p>`,
});
const feed = (await webClient.get(`feeds/${feedReference}.xml`)).body;
expect(feed.match(/<updated>(.+?)<\/updated>/)![1]).not.toBe(
feedBefore.match(/<updated>(.+?)<\/updated>/)![1]
);
expect(feed).toMatch(
html`<author><name>publisher@example.com</name></author>`
);
expect(feed).toMatch(html`<title>A subject</title>`);
expect(feed).toMatch(
html`<content type="html">${`<p>Some HTML content</p>`}</content>`
);
});
});
/*
describe("receive email", () => {
test("updated field is updated", async () => {