swaf/test/_mail_server.ts

20 lines
508 B
TypeScript
Raw Normal View History

import MailDev from "maildev";
export const MAIL_SERVER = new MailDev({
ip: 'localhost',
});
export async function setupMailServer(): Promise<void> {
await new Promise((resolve, reject) => MAIL_SERVER.listen((err?: Error) => {
if (err) reject(err);
else resolve();
}));
}
export async function teardownMailServer(): Promise<void> {
await new Promise((resolve, reject) => MAIL_SERVER.close((err?: Error) => {
if (err) reject(err);
else resolve();
}));
}