swaf/test/_mail_server.ts

19 lines
482 B
TypeScript
Raw Normal View History

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