From a80f844e88ea856d49f359ab1520d38629c497bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 9 Feb 2017 16:17:10 +0100 Subject: [PATCH] Upgrade supertest to 3.x Also fix tests relying on internal supertest API to keep working with then new supertest internals after the upgrade. --- package.json | 3 +-- test/context-options.test.js | 2 +- test/helpers/loopback-testing-helper.js | 2 +- test/relations.integration.js | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2bf5c93c..4f06c493 100644 --- a/package.json +++ b/package.json @@ -97,8 +97,7 @@ "sinon-chai": "^2.8.0", "strong-error-handler": "^1.0.1", "strong-task-emitter": "^0.0.6", - "supertest": "^2.0.0", - "supertest-as-promised": "^4.0.2" + "supertest": "^3.0.0" }, "repository": { "type": "git", diff --git a/test/context-options.test.js b/test/context-options.test.js index 99a159c4..f1db0f5e 100644 --- a/test/context-options.test.js +++ b/test/context-options.test.js @@ -7,7 +7,7 @@ var expect = require('chai').expect; var loopback = require('..'); -var supertest = require('supertest-as-promised')(require('bluebird')); +var supertest = require('supertest'); describe('OptionsFromRemotingContext', function() { var app, request, accessToken, userId, Product, actualOptions; diff --git a/test/helpers/loopback-testing-helper.js b/test/helpers/loopback-testing-helper.js index 8453f554..9d083469 100644 --- a/test/helpers/loopback-testing-helper.js +++ b/test/helpers/loopback-testing-helper.js @@ -184,7 +184,7 @@ _describe.whenCalledRemotely = function(verb, url, data, cb) { var test = this; this.http.end(function(err) { test.req = test.http.req; - test.res = test.http.res; + test.res = test.http.response; delete test.url; cb(); diff --git a/test/relations.integration.js b/test/relations.integration.js index 22ca2fcc..8b70fc20 100644 --- a/test/relations.integration.js +++ b/test/relations.integration.js @@ -191,7 +191,7 @@ describe('relations - integration', function() { if (err) return done(err); this.req = this.http.req; - this.res = this.http.res; + this.res = this.http.response; done(); }.bind(this));