Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
butlerx committed Nov 13, 2017
1 parent 6cd94bc commit d24c514
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
isMemberOf: {
role: 'basic-user',
},
};
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions test/skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)();
Expand Down Expand Up @@ -70,14 +70,14 @@ 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', id: {} }, (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;
const app = seneca.export('cd-organisations/acts').org;
app.get({ id: {} })
.catch((err) => {
expect(err.code).to.be.equal('act_invalid_msg');
Expand All @@ -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: 'org', cmd: 'create', org: {} }, (err, app) => {
expect(err.code).to.be.equal('act_invalid_msg');
done();
});
Expand Down

0 comments on commit d24c514

Please sign in to comment.