diff --git a/src/index.test.ts b/src/index.test.ts index 6adec53..6c547c2 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -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`
Some HTML content
`, + }); + const feed = (await webClient.get(`feeds/${feedReference}.xml`)).body; + expect(feed.match(/Some HTML content
`}