Package for help with testing you app. Creates api for test requesting, creates test database collection and mocked mailer.
import * as assert from 'assert';
import Koa from 'koa';
import { describe, it } from 'mocha';
import mailer from '@storyous/mailer';
import testUtils from '@storyous/test-utils';
testUtils.init(
() => new Koa(),
testUtils.uniqueDatabase('mongodb://127.0.0.0:27017/test'),
mailer,
);
describe('some test', async () => {
it('should do some request', async () => {
await testUtils.request().get('/').expect(200);
});
it('should getSent emails', async () => {
await mailer.sendMail({});
assert.deepStrictEqual(testUtils.getSentMails(), []);
});
};