diff --git a/__tests__/query.test.js b/__tests__/query.test.js index c73fc72..211b821 100644 --- a/__tests__/query.test.js +++ b/__tests__/query.test.js @@ -233,8 +233,7 @@ describe('Queries', () => { expect(data).toHaveProperty('size', {}); }); - // TODO should add support - test.skip('it can select many nested values', async () => { + test('it can select many nested values', async () => { const res = await db .collection('animals') .where('id', '==', 'cow') diff --git a/package-lock.json b/package-lock.json index 77aef06..b673283 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "jest": "^26.6.3", "jest-watch-typeahead": "^0.3.1", "lint-staged": "^10.0.2", + "lodash": "^4.17.21", "prettier": "^3.1.1", "ts-jest": "^26.5.1", "typescript": "^4.9.5" @@ -16244,7 +16245,8 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.camelcase": { "version": "4.3.0", diff --git a/package.json b/package.json index aad493a..0bfc53a 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "jest": "^26.6.3", "jest-watch-typeahead": "^0.3.1", "lint-staged": "^10.0.2", + "lodash": "^4.17.21", "prettier": "^3.1.1", "ts-jest": "^26.5.1", "typescript": "^4.9.5" diff --git a/src/mocks/helpers/buildDocFromHash.js b/src/mocks/helpers/buildDocFromHash.js index 50c1fd2..6321295 100644 --- a/src/mocks/helpers/buildDocFromHash.js +++ b/src/mocks/helpers/buildDocFromHash.js @@ -1,4 +1,5 @@ const timestamp = require('../timestamp'); +const {merge} = require('lodash'); module.exports = function buildDocFromHash(hash = {}, id = 'abc123', selectFields = undefined) { const exists = !!hash || false; @@ -31,10 +32,7 @@ module.exports = function buildDocFromHash(hash = {}, id = 'abc123', selectField if (selectFields !== undefined) { copy = selectFields.reduce((acc, field) => { const path = field.split('.'); - return { - ...acc, - ...buildDocFromPath(copy, path) - } + return merge(acc, buildDocFromPath(copy, path)); }, {}); }