From ecda250c6e7d1c65efe00a3605bf8913f57818d6 Mon Sep 17 00:00:00 2001 From: Berislav Date: Thu, 25 Oct 2018 01:54:30 -0700 Subject: [PATCH 1/3] Using npm chai instead of practicalmeteor:chai, updated peerlibrary:subscription-scope to 0.4.0 --- .travis.yml | 2 +- lib/testing/main.js | 3 +++ package.js | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) mode change 100644 => 100755 .travis.yml create mode 100755 lib/testing/main.js diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 index b455780..302f378 --- a/.travis.yml +++ b/.travis.yml @@ -27,5 +27,5 @@ before_script: script: - meteor create --bare test - cd test - - meteor npm i --save selenium-webdriver@3.6.0 chromedriver@2.36.0 simpl-schema + - meteor npm i --save selenium-webdriver@3.6.0 chromedriver@2.36.0 simpl-schema chai - METEOR_PACKAGE_DIRS="../" TEST_BROWSER_DRIVER=chrome meteor test-packages --once --driver-package meteortesting:mocha ../ \ No newline at end of file diff --git a/lib/testing/main.js b/lib/testing/main.js new file mode 100755 index 0000000..e19100b --- /dev/null +++ b/lib/testing/main.js @@ -0,0 +1,3 @@ +import chai from 'chai'; + +global.assert = chai.assert; diff --git a/package.js b/package.js index 4239ded..738a962 100755 --- a/package.js +++ b/package.js @@ -31,7 +31,7 @@ Package.onUse(function(api) { 'reywood:publish-composite@1.5.2', 'dburles:mongo-collection-instances@0.3.5', 'herteby:denormalize@0.6.5', - 'peerlibrary:subscription-scope@0.1.0', + 'peerlibrary:subscription-scope@0.4.0', ]; api.use(packages); @@ -50,14 +50,17 @@ 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.1.0', + 'peerlibrary:subscription-scope@0.4.0', 'mongo', ]; api.use(packages); api.use('tracker'); - api.use(['cultofcoders:mocha', 'practicalmeteor:chai']); + api.use(['meteortesting:mocha']); + + // main test config + api.addFiles('lib/testing/main.js'); // LINKS api.addFiles('lib/links/tests/main.js', 'server'); From eedf87c67a875ae168a44f021362ed7b0e60cb8a Mon Sep 17 00:00:00 2001 From: Berislav Date: Thu, 25 Oct 2018 02:27:13 -0700 Subject: [PATCH 2/3] Pass config to the nested publications in recursiveCompose --- lib/query/lib/recursiveCompose.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/query/lib/recursiveCompose.js b/lib/query/lib/recursiveCompose.js index 606f10d..fa94c09 100755 --- a/lib/query/lib/recursiveCompose.js +++ b/lib/query/lib/recursiveCompose.js @@ -41,14 +41,14 @@ function compose(node, userId, config) { } const cursor = accessor.find(filters, options, userId); - if (config && config.scoped) { + if (config.scoped) { patchCursor(cursor, getNodeNamespace(node)); } return cursor; } }, - children: _.map(node.collectionNodes, n => compose(n, userId)) + children: _.map(node.collectionNodes, n => compose(n, userId, config)) } } From 90aa1f80af3c41050ee87a1a736be62cf25b113e Mon Sep 17 00:00:00 2001 From: Berislav Date: Thu, 25 Oct 2018 02:48:02 -0700 Subject: [PATCH 3/3] Import assert for each test file --- lib/exposure/testing/client.js | 1 + lib/exposure/testing/units/units.js | 1 + lib/graphql/testing/astToBody.test.js | 1 + lib/graphql/testing/astToQuery.test.js | 1 + lib/links/tests/main.js | 1 + lib/namedQuery/testing/client.test.js | 1 + lib/namedQuery/testing/server.test.js | 1 + lib/query/counts/testing/client.test.js | 1 + lib/query/testing/client.test.js | 1 + lib/query/testing/link-cache/server.test.js | 1 + lib/query/testing/metaFilters.server.test.js | 1 + lib/query/testing/reducers.client.test.js | 1 + lib/query/testing/reducers.server.test.js | 1 + lib/query/testing/security.client.test.js | 1 + lib/query/testing/server.test.js | 1 + lib/testing/main.js | 3 --- package.js | 3 --- 17 files changed, 15 insertions(+), 6 deletions(-) mode change 100644 => 100755 lib/exposure/testing/client.js mode change 100644 => 100755 lib/exposure/testing/units/units.js mode change 100644 => 100755 lib/graphql/testing/astToBody.test.js mode change 100644 => 100755 lib/graphql/testing/astToQuery.test.js mode change 100644 => 100755 lib/links/tests/main.js mode change 100644 => 100755 lib/query/counts/testing/client.test.js mode change 100644 => 100755 lib/query/testing/metaFilters.server.test.js mode change 100644 => 100755 lib/query/testing/security.client.test.js delete mode 100755 lib/testing/main.js diff --git a/lib/exposure/testing/client.js b/lib/exposure/testing/client.js old mode 100644 new mode 100755 index ab35b37..b8492c4 --- a/lib/exposure/testing/client.js +++ b/lib/exposure/testing/client.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import Demo, { DemoMethod, DemoPublication diff --git a/lib/exposure/testing/units/units.js b/lib/exposure/testing/units/units.js old mode 100644 new mode 100755 index af11c1f..a812e09 --- a/lib/exposure/testing/units/units.js +++ b/lib/exposure/testing/units/units.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import restrictFields from '../../lib/restrictFields.js'; import enforceMaxLimit from '../../lib/enforceMaxLimit.js'; import cleanBody from '../../lib/cleanBody.js'; diff --git a/lib/graphql/testing/astToBody.test.js b/lib/graphql/testing/astToBody.test.js old mode 100644 new mode 100755 index 7488f23..acd3897 --- a/lib/graphql/testing/astToBody.test.js +++ b/lib/graphql/testing/astToBody.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import astToBody, { Symbols } from '../lib/astToBody'; import ast from './ast.js'; diff --git a/lib/graphql/testing/astToQuery.test.js b/lib/graphql/testing/astToQuery.test.js old mode 100644 new mode 100755 index 0fa93e9..645c044 --- a/lib/graphql/testing/astToQuery.test.js +++ b/lib/graphql/testing/astToQuery.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { Symbols } from '../lib/astToBody'; import astToQuery, { diff --git a/lib/links/tests/main.js b/lib/links/tests/main.js old mode 100644 new mode 100755 index 66d23cd..63b08bf --- a/lib/links/tests/main.js +++ b/lib/links/tests/main.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; //import { // PostCollection, // CategoryCollection, diff --git a/lib/namedQuery/testing/client.test.js b/lib/namedQuery/testing/client.test.js index d0aa1dd..f23f6c9 100755 --- a/lib/namedQuery/testing/client.test.js +++ b/lib/namedQuery/testing/client.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import postListExposure from './bootstrap/queries/postListExposure.js'; import postListExposureScoped from './bootstrap/queries/postListExposureScoped'; import userListScoped from './bootstrap/queries/userListScoped'; diff --git a/lib/namedQuery/testing/server.test.js b/lib/namedQuery/testing/server.test.js index baa1b68..c9c43ab 100755 --- a/lib/namedQuery/testing/server.test.js +++ b/lib/namedQuery/testing/server.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { postList, postListCached, diff --git a/lib/query/counts/testing/client.test.js b/lib/query/counts/testing/client.test.js old mode 100644 new mode 100755 index 0e1cbd5..bd2f137 --- a/lib/query/counts/testing/client.test.js +++ b/lib/query/counts/testing/client.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { Tracker } from 'meteor/tracker'; import PostsCollection from './bootstrap/collection.test'; import NamedQuery, { diff --git a/lib/query/testing/client.test.js b/lib/query/testing/client.test.js index e51f2c0..9ac090d 100755 --- a/lib/query/testing/client.test.js +++ b/lib/query/testing/client.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { createQuery } from 'meteor/cultofcoders:grapher'; import './reducers.client.test'; import './security.client.test'; diff --git a/lib/query/testing/link-cache/server.test.js b/lib/query/testing/link-cache/server.test.js index cc60716..3438c03 100755 --- a/lib/query/testing/link-cache/server.test.js +++ b/lib/query/testing/link-cache/server.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import createFixtures from './fixtures'; import { createQuery } from 'meteor/cultofcoders:grapher'; import { diff --git a/lib/query/testing/metaFilters.server.test.js b/lib/query/testing/metaFilters.server.test.js old mode 100644 new mode 100755 index 241e508..7c89a7c --- a/lib/query/testing/metaFilters.server.test.js +++ b/lib/query/testing/metaFilters.server.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { createQuery } from 'meteor/cultofcoders:grapher'; describe('Hypernova - $meta filters', function () { diff --git a/lib/query/testing/reducers.client.test.js b/lib/query/testing/reducers.client.test.js index 3c78538..8d36982 100755 --- a/lib/query/testing/reducers.client.test.js +++ b/lib/query/testing/reducers.client.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { createQuery } from 'meteor/cultofcoders:grapher'; import waitForHandleToBeReady from './lib/waitForHandleToBeReady'; diff --git a/lib/query/testing/reducers.server.test.js b/lib/query/testing/reducers.server.test.js index 613c91b..1b39ac6 100755 --- a/lib/query/testing/reducers.server.test.js +++ b/lib/query/testing/reducers.server.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { createQuery } from 'meteor/cultofcoders:grapher'; import Authors from './bootstrap/authors/collection'; import Comments from './bootstrap/comments/collection'; diff --git a/lib/query/testing/security.client.test.js b/lib/query/testing/security.client.test.js old mode 100644 new mode 100755 index ac4cd4e..2b7c97d --- a/lib/query/testing/security.client.test.js +++ b/lib/query/testing/security.client.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { createQuery } from 'meteor/cultofcoders:grapher'; import waitForHandleToBeReady from './lib/waitForHandleToBeReady'; diff --git a/lib/query/testing/server.test.js b/lib/query/testing/server.test.js index 4c53bd4..ec647fa 100755 --- a/lib/query/testing/server.test.js +++ b/lib/query/testing/server.test.js @@ -1,3 +1,4 @@ +import { assert } from 'chai'; import { createQuery } from 'meteor/cultofcoders:grapher'; import dot from 'dot-object'; import Comments from './bootstrap/comments/collection.js'; diff --git a/lib/testing/main.js b/lib/testing/main.js deleted file mode 100755 index e19100b..0000000 --- a/lib/testing/main.js +++ /dev/null @@ -1,3 +0,0 @@ -import chai from 'chai'; - -global.assert = chai.assert; diff --git a/package.js b/package.js index 738a962..529a032 100755 --- a/package.js +++ b/package.js @@ -59,9 +59,6 @@ Package.onTest(function(api) { api.use(['meteortesting:mocha']); - // main test config - api.addFiles('lib/testing/main.js'); - // LINKS api.addFiles('lib/links/tests/main.js', 'server');