-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathsocket-real-test.ts
44 lines (40 loc) · 1.93 KB
/
socket-real-test.ts
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
import expect from 'expect';
import { verifyEmail } from '../src';
describe('verifyEmailRealTest', () => {
it('should success on real email gmail', async () => {
const { validFormat, validMx, validSmtp } = await verifyEmail({ emailAddress: 'foo@google.com', verifyMx: true, verifySmtp: true });
expect(validFormat).toBe(true);
expect(validMx).toBe(true);
expect(validSmtp).toBe(true);
});
it('should success on invalid email hello.com', async () => {
const { validFormat, validMx, validSmtp } = await verifyEmail({ emailAddress: 'foohxxello2s8871@hello.com', verifyMx: true, verifySmtp: true });
expect(validFormat).toBe(true);
expect(validMx).toBe(true);
expect(validSmtp).toBe(false);
});
it('should fail on invalid domain', async () => {
const { validFormat, validMx, validSmtp } = await verifyEmail({ emailAddress: 'email@kk.com', verifyMx: true, verifySmtp: true });
expect(validFormat).toBe(true);
expect(validMx).toBe(false);
expect(validSmtp).toBe(false);
});
it('returns immediately if email is malformed invalid', async () => {
const { validFormat, validMx, validSmtp } = await verifyEmail({ emailAddress: 'bar.com' });
expect(validFormat).toBe(false);
expect(validMx).toBe(null);
expect(validSmtp).toBe(null);
});
it('should use custom port with mapped domain: ova.ca', async () => {
const { validFormat, validMx, validSmtp } = await verifyEmail({ emailAddress: 'support@ovh.com', debug: true, verifySmtp: true, verifyMx: true });
expect(validFormat).toBe(true);
expect(validMx).toBe(true);
expect(validSmtp).toBe(null);
});
it('should use custom port with mapped domain: qq.com', async () => {
const { validFormat, validMx, validSmtp } = await verifyEmail({ emailAddress: '10000000000000@qq.com', debug: true, verifySmtp: true, verifyMx: true });
expect(validFormat).toBe(true);
expect(validMx).toBe(true);
expect(validSmtp).toBe(null);
});
});