2020-09-25 23:42:15 +02:00
|
|
|
import MailDev from "maildev";
|
2020-07-08 10:49:29 +02:00
|
|
|
|
|
|
|
export const MAIL_SERVER = new MailDev({
|
|
|
|
ip: 'localhost',
|
|
|
|
});
|
|
|
|
|
2020-09-25 23:42:15 +02:00
|
|
|
export async function setupMailServer(): Promise<void> {
|
|
|
|
await new Promise((resolve, reject) => MAIL_SERVER.listen((err?: Error) => {
|
2020-07-08 10:49:29 +02:00
|
|
|
if (err) reject(err);
|
|
|
|
else resolve();
|
|
|
|
}));
|
2020-09-25 23:42:15 +02:00
|
|
|
}
|
2020-07-08 10:49:29 +02:00
|
|
|
|
2020-09-25 23:42:15 +02:00
|
|
|
export async function teardownMailServer(): Promise<void> {
|
|
|
|
await new Promise((resolve, reject) => MAIL_SERVER.close((err?: Error) => {
|
2020-07-08 10:49:29 +02:00
|
|
|
if (err) reject(err);
|
|
|
|
else resolve();
|
|
|
|
}));
|
2020-09-25 23:42:15 +02:00
|
|
|
}
|