mailgun/test/test.ts

32 lines
930 B
TypeScript
Raw Permalink Normal View History

2019-10-23 17:27:42 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2019-10-28 14:55:04 +00:00
import { Qenv } from '@pushrocks/qenv';
import * as smartmail from '@pushrocks/smartmail';
const testQenv = new Qenv('./', './.nogit');
2019-10-23 17:27:42 +00:00
import * as mailgun from '../ts/index';
2019-10-28 14:55:04 +00:00
let testMailgunAccount: mailgun.MailgunAccount;
let testSmartmail: smartmail.Smartmail;
2019-10-23 17:27:42 +00:00
tap.test('first test', async () => {
2019-10-28 14:55:04 +00:00
testMailgunAccount = new mailgun.MailgunAccount(testQenv.getEnvVarOnDemand('MAILGUN_API_TOKEN'));
expect(testMailgunAccount).to.be.instanceOf(mailgun.MailgunAccount);
});
tap.test('should create a smartmail', async () => {
testSmartmail = new smartmail.Smartmail({
body: 'hi there. This is the body.',
from: 'noreply@mail.lossless.com',
subject: 'hi there. This is the subject'
});
return testSmartmail;
});
tap.test('should send a smartmail', async () => {
testMailgunAccount.sendSmartMail(testSmartmail, 'phil@lossless.com');
2019-10-23 17:27:42 +00:00
});
tap.start();