📦️ Update smtp-tester and fix test environment config (#1181)

This commit is contained in:
Luke Vella 2024-06-27 14:37:00 +01:00 committed by GitHub
parent 0a0c38f1d4
commit f66653c21a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 45 additions and 128 deletions

View file

@ -4,7 +4,7 @@ import { load } from "cheerio";
import smtpTester from "smtp-tester";
const testUserEmail = "test@example.com";
let mailServer: smtpTester.SmtpTester;
let mailServer: smtpTester.MailServer;
/**
* Get the 6-digit code from the email
* @returns 6-digit code
@ -14,6 +14,10 @@ const getCode = async () => {
wait: 5000,
});
if (!email.html) {
throw new Error("Email doesn't contain HTML");
}
const $ = load(email.html);
return $("#code").text().trim();
@ -34,7 +38,8 @@ test.describe.serial(() => {
} catch {
// User doesn't exist
}
mailServer.stop();
mailServer.stop(() => {});
});
test.describe("new user", () => {
@ -109,6 +114,10 @@ test.describe.serial(() => {
wait: 5000,
});
if (!email.html) {
throw new Error("Email doesn't contain HTML");
}
const $ = load(email.html);
const magicLink = $("#magicLink").attr("href");