@storyous/test-utils
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

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(), []);
    });
};

Readme

Keywords

none

Package Sidebar

Install

npm i @storyous/test-utils

Weekly Downloads

14

Version

2.3.0

License

ISC

Unpacked Size

24.3 kB

Total Files

12

Last publish

Collaborators

  • danieldadateya
  • nte-saltpay
  • mkoubik
  • storyous-user
  • vaclav.obornik
  • tymak
  • ivo.sofranek