-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtests.js
73 lines (61 loc) · 3.17 KB
/
tests.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'use strict';
Tinytest.add('Only supported domains', function (test) {
test.equal(Email.normalize('[email protected]'), '[email protected]');
});
Tinytest.add('Gmail dots', function (test) {
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
});
Tinytest.add('plus', function (test) {
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
});
Tinytest.add('Non-standard TLDs', function (test) {
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]', {forceRemoveDots: true, forceRemoveTags: true}), '[email protected]');
});
Tinytest.add('Yahoo!', function (test) {
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
});
Tinytest.add('Microsoft', function (test) {
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
});
Tinytest.add('Google Apps for Work', function (test) {
test.equal(Email.normalize('[email protected]', {detectProvider: false}), '[email protected]');
if (Meteor.isServer) test.equal(Email.normalize('[email protected]', {detectProvider: true}), '[email protected]'); // sync server call
});
Tinytest.add('FastMail', function (test) {
test.equal(Email.normalize('[email protected]'), '[email protected]');
test.equal(Email.normalize('[email protected]'), '[email protected]');
// http://outcoldman.com/en/archive/2014/05/08/fastmail/
test.equal(Email.normalize('[email protected]', {detectProvider: false}), '[email protected]');
});
Tinytest.addAsync('Async test Google Apps for Work', function (test, done) {
Email.normalize('[email protected]', {detectProvider: true}, function (error, result) {
test.equal(result, '[email protected]');
done();
});
});
Tinytest.addAsync('Async test Fastmail', function (test, done) {
Email.normalize('[email protected]', {detectProvider: true}, function (error, result) {
test.equal(result, '[email protected]');
done();
});
});
Tinytest.addAsync('Async test no special provider', function (test, done) {
Email.normalize('[email protected]', {detectProvider: true}, function (error, result) {
test.equal(result, '[email protected]', 'Returning the same email when no providers have been detected');
done();
});
});
if (Meteor.isClient) Tinytest.add('Async test on the client requires callback', function (test) {
test.throws(function () {
Email.normalize('[email protected]', {detectProvider: true});
}, /callback/);
});