Make unit tests pass in node 8 (#643)

* make tests not crash in node 8

* upgrade nock

This makes tests pass in node 8, as well as node 6
This commit is contained in:
Dominykas Blyžė
2018-03-14 05:59:37 +02:00
committed by Spencer
parent b7fae6f94b
commit 263bec4e03
3 changed files with 10 additions and 4 deletions

View File

@ -434,7 +434,7 @@ describe('Http Connector', function () {
con.request({
body: body
}, function (err, resp, status) {
expect(http.ClientRequest.prototype.setHeader.lastCall.args).to.eql(['Content-Length', 14]);
expect(http.ClientRequest.prototype.setHeader.args.find((arg) => arg[0] === 'Content-Length')).to.eql(['Content-Length', 14]);
server.done();
done();
});
@ -444,7 +444,10 @@ describe('Http Connector', function () {
var con = new HttpConnection(new Host());
var respBody = 'i should not be encoded';
var server = nock('http://localhost:9200')
.matchHeader('accept-encoding', undefined)
.matchHeader('accept-encoding', function (v) {
return v === undefined;
})
.get('/')
.once()
.reply(200, respBody);