From 2bbc6bb95b9328f6e0e6eab1a55579e1c701d41c Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Thu, 7 Jul 2016 22:07:54 -0700 Subject: [PATCH 1/3] chore(package): update feathers-service-tests to version 0.6.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a33a1223..b23142ff 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "feathers": "^2.0.0-pre.4", "feathers-hooks": "^1.1.0", "feathers-rest": "^1.2.2", - "feathers-service-tests": "^0.6.0", + "feathers-service-tests": "^0.6.2", "feathers-socketio": "^1.3.3", "jshint": "^2.8.0", "mocha": "^2.5.0", From f96f7730817316022c1aae00a479bbe4c89f9d48 Mon Sep 17 00:00:00 2001 From: David Luecke Date: Fri, 8 Jul 2016 18:58:58 -0700 Subject: [PATCH 2/3] Make sure original data are not being modified --- package.json | 2 +- src/index.js | 2 -- src/service.js | 5 +++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b23142ff..5b4f8098 100644 --- a/package.json +++ b/package.json @@ -53,9 +53,9 @@ "lib": "lib" }, "dependencies": { - "babel-polyfill": "^6.3.14", "feathers-errors": "^2.0.1", "feathers-query-filters": "^1.5.1", + "lodash.omit": "^4.3.0", "uberproto": "^1.2.0" }, "devDependencies": { diff --git a/src/index.js b/src/index.js index 727c4cf6..66a3f3dd 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,3 @@ -if(!global._babelPolyfill) { require('babel-polyfill'); } - import * as hooks from './hooks'; import service from './service'; diff --git a/src/service.js b/src/service.js index 97254024..cf5317fe 100644 --- a/src/service.js +++ b/src/service.js @@ -1,3 +1,4 @@ +import omit from 'lodash.omit'; import Proto from 'uberproto'; import filter from 'feathers-query-filters'; import errors from 'feathers-errors'; @@ -147,11 +148,11 @@ class Service { if (this.id === '_id') { // We can not update default mongo ids - delete data[this.id]; + data = omit(data, this.id); } else { // If not using the default Mongo _id field set the id to its // previous value. This prevents orphaned documents. - data[this.id] = id; + data = Object.assign({}, data, { [this.id]: id }); } return this.Model From 4ff66c5a35130133e0a602767cab46b360876995 Mon Sep 17 00:00:00 2001 From: David Luecke Date: Fri, 8 Jul 2016 19:15:41 -0700 Subject: [PATCH 3/3] Load Feathers with babel-polyfill in all tests --- package.json | 2 +- test/error-handler.test.js | 1 + test/hooks.test.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5b4f8098..bac82d17 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "babel-preset-es2015": "^6.1.2", "body-parser": "^1.14.1", "chai": "^3.4.1", - "feathers": "^2.0.0-pre.4", + "feathers": "^2.0.0", "feathers-hooks": "^1.1.0", "feathers-rest": "^1.2.2", "feathers-service-tests": "^0.6.2", diff --git a/test/error-handler.test.js b/test/error-handler.test.js index 5b4514c4..8968a33b 100644 --- a/test/error-handler.test.js +++ b/test/error-handler.test.js @@ -1,3 +1,4 @@ +import 'feathers'; import { expect } from 'chai'; import mongoose from 'mongoose'; import errors from 'feathers-errors'; diff --git a/test/hooks.test.js b/test/hooks.test.js index 023d7c7b..efcfa6e4 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -1,3 +1,4 @@ +import 'feathers'; import chai from 'chai'; import sinon from 'sinon'; import sinonChai from 'sinon-chai';