smartsmtp/test/test.ts

31 lines
932 B
TypeScript
Raw Permalink Normal View History

2020-08-12 14:13:20 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartsmtp from '../ts/index';
import { Qenv } from '@pushrocks/qenv';
import * as smartmail from '@pushrocks/smartmail';
const testQenv = new Qenv('./', './.nogit');
let testSmartsmtp: smartsmtp.Smartsmtp;
tap.test('should create a valid instance of Smartsmtp', async () => {
testSmartsmtp = new smartsmtp.Smartsmtp({
smtpServer: testQenv.getEnvVarOnDemand('SMTP_SERVER'),
smtpUser: testQenv.getEnvVarOnDemand('SMTP_USER'),
smtpPassword: testQenv.getEnvVarOnDemand('SMTP_PASSWORD'),
});
expect(testSmartsmtp).to.be.instanceOf(smartsmtp.Smartsmtp);
});
tap.test('should send a message', async () => {
const result = await testSmartsmtp.sendSmartMail(new smartmail.Smartmail({
body: '',
from: 'smartsmtp@mail.lossless.one',
subject: 'this is a test message',
}), 'sandbox@mail.git.zone');
console.log(result);
});
tap.start();