visionmedia/supertest — pull request #87 by timruffles (2013-12-03 16:03:21+00:00)
Title: add expect(function(res) {}) syntax

Adding the ability for `expect()` pass custom assertion functions
makes it easy to create reusable assertions (and simple plugins).

For instance, an API might require a certain content-type and 'next'
and 'previous' keys in a number of endpoints. With the ability to pass in an
assertion function this use-case becomes very simple:

request(app).get('/').expect(validPagedApiResponse).end(done);

function validPagedApiResponse(res) {
if(!('next' in res.body)) return "All responses require a 'next'
key";
// etc, lots of extra testing we can now apply in a single line
}