test: fix too strict test assertion

Rework the test verifying properties of `loopback` to ignore
new express properties added after the test was written.

Ignore "json" and "urlencoded" middleware that was added back
to Express, keep using our wrappers printing a deprecation message.
This commit is contained in:
Miroslav Bajtoš 2017-10-04 10:31:50 +02:00
parent cd8f1775bc
commit 4f928bf965
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
2 changed files with 7 additions and 2 deletions

View File

@ -45,7 +45,7 @@
"depd": "^1.0.0", "depd": "^1.0.0",
"ejs": "^2.3.1", "ejs": "^2.3.1",
"errorhandler": "^1.3.4", "errorhandler": "^1.3.4",
"express": "^4.12.2", "express": "^4.16.2",
"inflection": "^1.6.0", "inflection": "^1.6.0",
"isemail": "^1.2.0", "isemail": "^1.2.0",
"loopback-connector-remote": "^1.0.3", "loopback-connector-remote": "^1.0.3",

View File

@ -117,7 +117,7 @@ describe('loopback', function() {
var actual = Object.getOwnPropertyNames(loopback); var actual = Object.getOwnPropertyNames(loopback);
actual.sort(); actual.sort();
expect(actual).to.eql(EXPECTED); expect(actual).to.include.members(EXPECTED);
}); });
}); });
@ -530,6 +530,11 @@ describe('loopback', function() {
it('inherits properties from express', function() { it('inherits properties from express', function() {
var express = require('express'); var express = require('express');
for (var i in express) { for (var i in express) {
// Express added back body-parsing middleware in v4.16.0, see
// https://github.com/expressjs/express/issues/2211
// However, we are keeping them deprecated in 2.x,
// because it's in LTS mode
if (i === 'json' || i === 'urlencoded') continue;
expect(loopback).to.have.property(i, express[i]); expect(loopback).to.have.property(i, express[i]);
} }
}); });