-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
executable file
·55 lines (52 loc) · 1.42 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!./node_modules/mocha/bin/_mocha
const { expect, request } = require('chai');
const validateEmail = require("./index.js");
const Promise = require("bluebird");
describe('Live Integration Tests', () => {
describe('Valid Emails',
() => [
"smokejumperit@gmail.com",
"smokejumperit+1@gmail.com",
"smokejumperit+oct1@gmail.com",
"smokejumperit+oct.1@gmail.com",
"robert@getbeewell.com",
"robert@beewell.health",
"robert+1@beewell.health",
"robert+oct1@beewell.health",
"robert+oct.1@beewell.health",
].forEach(
(email) => it(
"should return valid for " + email,
() => validateEmail(email).then((result) => expect(result).to.be.true)
)
)
);
describe('Invalid Emails',
() => [
'root',
'smokejumperit@.com',
null,
undefined,
1,
'@gmail.com',
'smokejumperit@',
'smokejumperit@gmail.',
' ',
' @ ',
' @ .com',
' @gmail.com',
"robert@getbeewell.com ",
" robert@getbeewell.com",
" robert@getbeewell.com ",
'smokejumperit@totally.invalid.tld.asdfjadfkajsflksjfdakldjsfaslksj',
'smokejumperit@slippery.email',
'smokejumperit@maildrop.cc',
'robert@gmail@com',
].forEach(
(email) => it(
"should return INvalid for " + email,
() => validateEmail(email).then((result) => expect(result).to.not.be.ok)
)
)
);
});