0.1.0-alpha.3 • Published 9 years ago
testresources v0.1.0-alpha.3
test resources
Designed to be used with superagent and koa, makes it easy to write simple assertions about HTTP responses:
describe('when you test a put request', function () {
var testServer, request;
before(function () {
var app = koa();
app.use(bodyParser());
app.use(router(app));
app.put('/dogs', function * () {
this.response.body = this.request.body;
this.status = 201;
});
return startServer(app).then(function (runningServer) {
testServer = runningServer;
});
})
beforeEach(function () {
request = superAgent
.put(testServer.fullUrl('/dogs'))
.send({ name: 'fido' });
});
after(function (done) {
testServer.close(done);
})
it('should pass if your expectations are correct', function () {
return resourceTest(request)
.expectStatus(201)
.expectBody({ name: 'fido' })
.run(testServer)
});
});
0.1.0-alpha.3
9 years ago
0.1.0-alpha.2
9 years ago
0.1.0-alpha.1
9 years ago
0.0.93-alpha.3
10 years ago
0.0.93-alpha.1
10 years ago
0.0.92-alpha.2
10 years ago
0.0.92-alpha.1
10 years ago
0.0.91
11 years ago
0.0.90
11 years ago
0.0.89
11 years ago
0.0.87
11 years ago
0.0.86
11 years ago
0.0.85
11 years ago
0.0.84
11 years ago
0.0.82
11 years ago
0.0.81
12 years ago
0.0.8
12 years ago
0.0.77
12 years ago
0.0.75
12 years ago
0.0.74
12 years ago
0.0.73
12 years ago
0.0.71
12 years ago
0.0.7
12 years ago
0.0.6
12 years ago
0.0.5
12 years ago
0.0.4
12 years ago
0.0.3
12 years ago
0.0.2
12 years ago
0.0.1
12 years ago