@alterior/testing
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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' }])
			)
	);
});

Readme

Keywords

none

Package Sidebar

Install

npm i @alterior/testing

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • rezonant