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

@ -83,7 +83,7 @@
"mocha-lcov-reporter": "0.0.1",
"mocha-screencast-reporter": "~0.1.4",
"moment": "^2.13.0",
"nock": "~0.28.3",
"nock": "^9.2.3",
"null-loader": "^0.1.1",
"open": "0.0.5",
"optimist": "~0.6.0",

View File

@ -71,7 +71,10 @@ _.each([
_['isArrayOf' + type + 's'] = function (arr) {
// quick shallow check of arrays
return _.isArray(arr) && _.every(arr.slice(0, 10), check);
return _.isArray(arr) && _.every(arr.slice(0, 10), function (item) {
return check(item);
});
};
});

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);