This commit is contained in:
parent
448cc22c6a
commit
bf6b6d7d90
|
@ -13,6 +13,7 @@ let webServer: http.Server;
|
||||||
let emailServer: net.Server;
|
let emailServer: net.Server;
|
||||||
let webClient: got.Got;
|
let webClient: got.Got;
|
||||||
let emailClient: nodemailer.Transporter;
|
let emailClient: nodemailer.Transporter;
|
||||||
|
let emailHost: string;
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
const rootDirectory = fs.mkdtempSync(
|
const rootDirectory = fs.mkdtempSync(
|
||||||
path.join(os.tmpdir(), "kill-the-newsletter--test--")
|
path.join(os.tmpdir(), "kill-the-newsletter--test--")
|
||||||
|
@ -24,6 +25,7 @@ beforeAll(() => {
|
||||||
);
|
);
|
||||||
webClient = got.default.extend({ prefixUrl: webApplication.get("url") });
|
webClient = got.default.extend({ prefixUrl: webApplication.get("url") });
|
||||||
emailClient = nodemailer.createTransport(webApplication.get("email"));
|
emailClient = nodemailer.createTransport(webApplication.get("email"));
|
||||||
|
emailHost = new URL(webApplication.get("url")).hostname;
|
||||||
});
|
});
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
webServer.close();
|
webServer.close();
|
||||||
|
@ -61,7 +63,7 @@ describe("Receive email", () => {
|
||||||
const feedBefore = (await webClient.get(`feeds/${feedReference}.xml`)).body;
|
const feedBefore = (await webClient.get(`feeds/${feedReference}.xml`)).body;
|
||||||
await emailClient.sendMail({
|
await emailClient.sendMail({
|
||||||
from: "publisher@example.com",
|
from: "publisher@example.com",
|
||||||
to: `${feedReference}@$localhost`,
|
to: `${feedReference}@${emailHost}`,
|
||||||
subject: "A subject",
|
subject: "A subject",
|
||||||
html: html`<p>Some HTML content</p>`,
|
html: html`<p>Some HTML content</p>`,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue