Aug 22, 2017 · 1 min read
Do you happen to have an example of how to unit test an HTTP function?
I get an “TypeError: app.address is not a function” when trying to import my module and test it using chai-request, like this:
…
api = require(“../api”);
…
chai.request(api)
.post(‘/v1/benchmark’)
.type(‘application/json’)
.send({
‘value’: ‘1234’
})
.end((err, res) => {
should.not.exist(err);
res.status.should.equal(200);
res.type.should.equal(‘application/json’);
});
