aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/miscs
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-30 15:16:24 +0100
committerChocobozzz <me@florianbigard.com>2018-01-30 15:16:24 +0100
commitf076daa76a32074cba162459e38fa8c130ad42d0 (patch)
treeea8a92d6305afa158b7774b65e9e6098cc094b92 /server/tests/utils/miscs
parentecb4e35f4e6c7304cb274593c13cb47fd5078b75 (diff)
downloadPeerTube-f076daa76a32074cba162459e38fa8c130ad42d0.tar.gz
PeerTube-f076daa76a32074cba162459e38fa8c130ad42d0.tar.zst
PeerTube-f076daa76a32074cba162459e38fa8c130ad42d0.zip
Add tests for emails
Diffstat (limited to 'server/tests/utils/miscs')
-rw-r--r--server/tests/utils/miscs/email.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/server/tests/utils/miscs/email.ts b/server/tests/utils/miscs/email.ts
new file mode 100644
index 000000000..21accd09d
--- /dev/null
+++ b/server/tests/utils/miscs/email.ts
@@ -0,0 +1,25 @@
1import * as MailDev from 'maildev'
2
3function mockSmtpServer (emailsCollection: object[]) {
4 const maildev = new MailDev({
5 ip: '127.0.0.1',
6 smtp: 1025,
7 disableWeb: true,
8 silent: true
9 })
10 maildev.on('new', email => emailsCollection.push(email))
11
12 return new Promise((res, rej) => {
13 maildev.listen(err => {
14 if (err) return rej(err)
15
16 return res()
17 })
18 })
19}
20
21// ---------------------------------------------------------------------------
22
23export {
24 mockSmtpServer
25}