@alterior/testing

A testing framework to complement Alterior

Usage no npm install needed!

<script type="module">
  import alteriorTesting from 'https://cdn.skypack.dev/@alterior/testing';
</script>

README

Alterior Testing

Provides a thin shim above mocha and supertest that simplifies testing apps using alterior. Tries to remain familiar to existing mocha users while reducing boilerplate and making testing more natural.

import { teststrap, it } from 'teststrap';
import { App } from './app.ts';

teststrap(App);

describe("/people", () => {
    it("should produce a list of people", 
        app => app.get('/people')
            .expect(200, <any>[])
    );

    it("should allow you to add a person", 
        app => app.put('/people')
            .send({id: 123, name: 'Santa'})
            .expect(201)
    );

    it("should show you a person after they have been added", 
        app => Promise.resolve()
            .then(() => app.put('/people').send({id: 123, name: 'Santa'})
                .expect(201, <any>[])
            )
            .then(() => app.get('/people')
                .expect(200, <any>[{ id: 123, name: 'Santa' }])
            )
    );
});