@storyous/test-utils
v2.3.0
Published
Package for help with testing you app. Creates api for test requesting, creates test database collection and mocked mailer.
Downloads
96
Keywords
Readme
testUtils
Package for help with testing you app. Creates api for test requesting, creates test database collection and mocked mailer.
Usage
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(), []);
});
};