diff --git a/.circleci/config.yml b/.circleci/config.yml index b8734ef..d477480 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,8 +23,14 @@ jobs: yarn add cp-translations@staging fi - run: - name: Tests + name: Unit Tests command: yarn test + - run: + name: Test joi + command: yarn test-joi + - run: + name: Test skeleton + command: yarn test-skeleton deploy: working_directory: ~/cp-organisations-service docker: diff --git a/lib/organisations/controllers/userOrg/perms/isMemberOf/perm.js b/lib/organisations/controllers/userOrg/perms/isMemberOf/perm.js new file mode 100644 index 0000000..9ca534a --- /dev/null +++ b/lib/organisations/controllers/userOrg/perms/isMemberOf/perm.js @@ -0,0 +1,5 @@ +module.exports = { + isMemberOf: { + role: 'basic-user', + }, +}; diff --git a/package.json b/package.json index bf0ce84..ec1fc82 100644 --- a/package.json +++ b/package.json @@ -5,17 +5,14 @@ "main": "index.js", "scripts": { "test": "lab lib -P spec -r console -v -m 3000 -c -t 80", - "testjoi": "lab test/joi.test.js -r console -v -m 3000 -c -t 80", - "testskeleton": "lab test/skeleton.js -r console -v -m 3000 -c -t 80", + "test-joi": "lab test/joi.test.js -r console -v -m 3000", + "test-skeleton": "lab test/skeleton.js -r console -v -m 3000 -c -t 80", "lint": "eslint .", "fix": "eslint . --fix", "start": "node index.js", "dev": "nodemon index.js" }, - "keywords": [ - "organisation", - "coderdojo" - ], + "keywords": ["organisation", "coderdojo"], "author": "Coderdojo", "license": "ISC", "devDependencies": { diff --git a/test/skeleton.js b/test/skeleton.js index 5805f8e..e09e095 100644 --- a/test/skeleton.js +++ b/test/skeleton.js @@ -3,7 +3,7 @@ require('../network')(seneca); const _ = require('lodash'); const flat = require('flat'); -const service = 'cd-eventbrite'; +const service = 'cd-organisations'; // ENTITIES const entities = {}; entities.userOrg = require('../lib/organisations/entities/userOrg.js').bind(seneca)(); @@ -70,15 +70,15 @@ describe('cp-organisations-service-controller', () => { // // VALIDATION // No need to validate them all, we just want to verify the bootloader (/lib/index) it('should validate entities acts with joi', (done) => { - seneca.act({ role: 'cd-organisations', entity: 'event', cmd: 'get', id: {} }, (err, app) => { + seneca.act({ role: 'cd-organisations', entity: 'org', cmd: 'get'}, (err, app) => { expect(err.code).to.be.equal('act_invalid_msg'); done(); }); }); // it('should validate entities acts while promised with joi', (done) => { - const app = seneca.export('cd-organisations/acts').event; - app.get({ id: {} }) + const app = seneca.export('cd-organisations/acts').org; + app.get({ org: undefined}) .catch((err) => { expect(err.code).to.be.equal('act_invalid_msg'); done(); @@ -86,7 +86,7 @@ describe('cp-organisations-service-controller', () => { }); // it('should validate controllers acts with joi', (done) => { - seneca.act({ role: 'cd-organisations', ctrl: 'auth', cmd: 'authorize', dojoId: {} }, (err, app) => { + seneca.act({ role: 'cd-organisations', ctrl: 'userOrg', cmd: 'create', userOrg: {} }, (err, app) => { expect(err.code).to.be.equal('act_invalid_msg'); done(); });