From 4f928bf965cd76947ff939de1917b99448743891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 4 Oct 2017 10:31:50 +0200 Subject: [PATCH] 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. --- package.json | 2 +- test/loopback.test.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index afc9ea4d..9f1fff65 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "depd": "^1.0.0", "ejs": "^2.3.1", "errorhandler": "^1.3.4", - "express": "^4.12.2", + "express": "^4.16.2", "inflection": "^1.6.0", "isemail": "^1.2.0", "loopback-connector-remote": "^1.0.3", diff --git a/test/loopback.test.js b/test/loopback.test.js index 3f833b0a..7b9b9f41 100644 --- a/test/loopback.test.js +++ b/test/loopback.test.js @@ -117,7 +117,7 @@ describe('loopback', function() { var actual = Object.getOwnPropertyNames(loopback); 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() { var express = require('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]); } });