From 2a99080d94482dbed0ba85cf2efabf2b78c36632 Mon Sep 17 00:00:00 2001 From: Theodor Diaconu Date: Fri, 15 Feb 2019 05:55:49 +0200 Subject: [PATCH] Fixed internal testing process --- lib/links/tests/main.js | 1 + lib/query/testing/server.test.js | 26 ++++++++++++++++++++++++++ package.js | 3 +-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/links/tests/main.js b/lib/links/tests/main.js index 63b08bf..564e752 100755 --- a/lib/links/tests/main.js +++ b/lib/links/tests/main.js @@ -1,4 +1,5 @@ import { assert } from 'chai'; + //import { // PostCollection, // CategoryCollection, diff --git a/lib/query/testing/server.test.js b/lib/query/testing/server.test.js index 8bd6e38..cedc57b 100755 --- a/lib/query/testing/server.test.js +++ b/lib/query/testing/server.test.js @@ -822,4 +822,30 @@ describe('Hypernova', function() { // no link storage assert.isUndefined(user.shoppingCartsData); }); + + it('Should be able to work with custom $filter function and using $and', () => { + ShoppingCart.remove({}); + ShoppingCart.insert({ value: 1 }); + ShoppingCart.insert({ value: 2 }); + ShoppingCart.insert({ value: 3 }); + ShoppingCart.insert({ value: 4 }); + + const data = ShoppingCart.createQuery({ + $filter({ + filters, + params + }) { + let $or = []; + params.values.forEach(v => $or.push({ value: v })); + + filters.$or = $or; + } + }, { + params: { + values: [1, 2] + } + }).fetch(); + + assert.lengthOf(data, 2); + }) }); diff --git a/package.js b/package.js index 332dcc1..aa13260 100755 --- a/package.js +++ b/package.js @@ -30,8 +30,8 @@ Package.onUse(function(api) { 'matb33:collection-hooks@0.8.4', 'reywood:publish-composite@1.5.2', 'dburles:mongo-collection-instances@0.3.5', - 'herteby:denormalize@0.6.5', 'peerlibrary:subscription-scope@0.4.0', + 'herteby:denormalize@0.6.5', ]; api.use(packages); @@ -50,7 +50,6 @@ Package.onTest(function(api) { 'reywood:publish-composite@1.5.2', 'dburles:mongo-collection-instances@0.3.5', 'herteby:denormalize@0.6.5', - 'peerlibrary:subscription-scope@0.4.0', 'mongo', ];