2018-09-29 21:57:25 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
|
|
|
import * as smartmail from '../ts/index';
|
|
|
|
|
2020-06-18 15:34:05 +00:00
|
|
|
let emailAddressValidatorInstance: smartmail.EmailAddressValidator;
|
|
|
|
|
|
|
|
tap.test('should create an instance of EmailAddressValidator', async () => {
|
|
|
|
emailAddressValidatorInstance = new smartmail.EmailAddressValidator();
|
|
|
|
expect(emailAddressValidatorInstance).to.be.instanceOf(smartmail.EmailAddressValidator);
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.test('should validate an email', async () => {
|
|
|
|
const result = await emailAddressValidatorInstance.validate('sandbox@bleu.de');
|
2020-06-18 21:04:52 +00:00
|
|
|
expect(result.freemail).to.be.false;
|
|
|
|
expect(result.disposable).to.be.false;
|
|
|
|
console.log(result);
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.test('should recognize an email as freemail', async () => {
|
|
|
|
const result = await emailAddressValidatorInstance.validate('sandbox@gmail.com');
|
|
|
|
expect(result.freemail).to.be.true;
|
|
|
|
expect(result.disposable).to.be.false;
|
|
|
|
console.log(result);
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.test('should recognize an email as disposable', async () => {
|
|
|
|
const result = await emailAddressValidatorInstance.validate('sandbox@gmx.de');
|
|
|
|
expect(result.freemail).to.be.false;
|
|
|
|
expect(result.disposable).to.be.true;
|
|
|
|
console.log(result);
|
2020-06-18 15:34:05 +00:00
|
|
|
});
|
|
|
|
|
2020-06-18 16:21:06 +00:00
|
|
|
tap.test('should create a SmartMail', async () => {
|
2019-10-26 21:45:35 +00:00
|
|
|
const testSmartmail = new smartmail.Smartmail({
|
|
|
|
body: 'hi there',
|
|
|
|
from: 'noreply@mail.lossless.com',
|
|
|
|
subject: 'hi from here'
|
|
|
|
});
|
2018-09-29 21:57:25 +00:00
|
|
|
expect(testSmartmail).to.be.instanceof(smartmail.Smartmail);
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.start();
|