0.0.2 • Published 9 years ago

@alterior/testing v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

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