diff --git a/lib/shallow-populate.js b/lib/shallow-populate.js index f47774f..d56db4b 100644 --- a/lib/shallow-populate.js +++ b/lib/shallow-populate.js @@ -114,7 +114,7 @@ module.exports = function (options) { const providedParams = (isFunction(i.params)) ? i.params(params, context) : i.params - if (providedParams && params != providedParams) params = merge(params, providedParams) + if (providedParams && params !== providedParams) params = merge(params, providedParams) return params }) diff --git a/test/shallow-populate.test.js b/test/shallow-populate.test.js index d56612e..f00291f 100644 --- a/test/shallow-populate.test.js +++ b/test/shallow-populate.test.js @@ -251,8 +251,8 @@ describe('shallowPopulate hook', function () { service () { return { find (params = {}) { - assert.deepEqual(params.query.id.$in, [], 'we have the params from shallow-populate') - assert.deepEqual(params.query.$select, ['id'], 'we have a merged query') + assert.deepStrictEqual(params.query.id.$in, [], 'we have the params from shallow-populate') + assert.deepStrictEqual(params.query.$select, ['id'], 'we have a merged query') return [] } } @@ -286,7 +286,7 @@ describe('shallowPopulate hook', function () { keyHere: 'postsId', keyThere: 'id', params: (params, context) => { - params.query.$select = ["id"] + params.query.$select = ['id'] } } } @@ -298,8 +298,8 @@ describe('shallowPopulate hook', function () { service () { return { find (params = {}) { - assert.deepEqual(params.query.id.$in, [], 'we have the params from shallow-populate') - assert.deepEqual(params.query.$select, ['id'], 'we have a merged query') + assert.deepStrictEqual(params.query.id.$in, [], 'we have the params from shallow-populate') + assert.deepStrictEqual(params.query.$select, ['id'], 'we have a merged query') return [] } } @@ -334,7 +334,7 @@ describe('shallowPopulate hook', function () { keyThere: 'id', params: (params, context) => { assert(context.method === 'create', 'we can pass the context to include') - params.method = context.method; + params.method = context.method } } } @@ -371,7 +371,6 @@ describe('shallowPopulate hook', function () { .catch(done) }) - it('does nothing if we have no data', function (done) { const options = { include: {