Skip to content

Commit

Permalink
fix: merge selection
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoSantoro94 committed Dec 3, 2024
1 parent ef7cbca commit 9a2c47b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions __tests__/query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions src/mocks/helpers/buildDocFromHash.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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));
}, {});
}

Expand Down

0 comments on commit 9a2c47b

Please sign in to comment.