0.7.0 • Published 5 years ago
middleware-tester v0.7.0
middleware tester
Test your middleware with fake requests.
example
Example using tap and flask-router-plus:
var mwtest = require('middleware-tester');
var t = require('blue-tape');
var router = require('flask-router-plus')();
router.get('/get', function(req, res) {
res.answer(200, req.query);
});
router.post('/post', function(req, res) {
res.answer(200, req.body);
});
var tester = mwtest(router.route);
t.test('get', function(t) {
return tester.getJSON('/get', {a: 1, b:2}).then(res) {
t.equals(res.body.a, 1);
t.equals(res.body.b, 2);
});
});
t.test('post', function(t) {
return tester.postJSON('/post', {a: 1, b:2}).then(function(res) {
t.equals(res.body.a, 1);
t.equals(res.body.b, 2);
});
});
api
TODO
0.7.0
5 years ago
0.6.2
6 years ago
0.6.1
6 years ago
0.6.0
6 years ago
0.5.4
7 years ago
0.5.3
7 years ago
0.5.2
7 years ago
0.5.1
7 years ago
0.5.0
7 years ago
0.4.2
9 years ago
0.4.1
9 years ago
0.4.0
9 years ago
0.3.4
9 years ago
0.3.3
10 years ago
0.3.2
10 years ago
0.3.1
10 years ago
0.3.0
10 years ago
0.2.4
10 years ago
0.2.3
10 years ago
0.2.2
10 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.6
11 years ago
0.1.5
11 years ago
0.1.4
11 years ago
0.1.3
11 years ago
0.1.1
11 years ago
0.1.0
11 years ago