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

Commit b950aef

Browse files
committed
fix tests
1 parent 6cd94bc commit b950aef

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

.circleci/config.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ jobs:
2323
yarn add cp-translations@staging
2424
fi
2525
- run:
26-
name: Tests
26+
name: Unit Tests
2727
command: yarn test
28+
- run:
29+
name: Test joi
30+
command: yarn test-joi
31+
- run:
32+
name: Test skeleton
33+
command: yarn test-skeleton
2834
deploy:
2935
working_directory: ~/cp-organisations-service
3036
docker:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
isMemberOf: {
3+
role: 'basic-user',
4+
},
5+
};

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "lab lib -P spec -r console -v -m 3000 -c -t 80",
8-
"testjoi": "lab test/joi.test.js -r console -v -m 3000 -c -t 80",
9-
"testskeleton": "lab test/skeleton.js -r console -v -m 3000 -c -t 80",
8+
"test-joi": "lab test/joi.test.js -r console -v -m 3000",
9+
"test-skeleton": "lab test/skeleton.js -r console -v -m 3000 -c -t 80",
1010
"lint": "eslint .",
1111
"fix": "eslint . --fix",
1212
"start": "node index.js",
1313
"dev": "nodemon index.js"
1414
},
15-
"keywords": [
16-
"organisation",
17-
"coderdojo"
18-
],
15+
"keywords": ["organisation", "coderdojo"],
1916
"author": "Coderdojo",
2017
"license": "ISC",
2118
"devDependencies": {

test/skeleton.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require('../network')(seneca);
33
const _ = require('lodash');
44
const flat = require('flat');
55

6-
const service = 'cd-eventbrite';
6+
const service = 'cd-organisations';
77
// ENTITIES
88
const entities = {};
99
entities.userOrg = require('../lib/organisations/entities/userOrg.js').bind(seneca)();
@@ -70,14 +70,14 @@ describe('cp-organisations-service-controller', () => {
7070
// // VALIDATION
7171
// No need to validate them all, we just want to verify the bootloader (/lib/index)
7272
it('should validate entities acts with joi', (done) => {
73-
seneca.act({ role: 'cd-organisations', entity: 'event', cmd: 'get', id: {} }, (err, app) => {
73+
seneca.act({ role: 'cd-organisations', entity: 'org', cmd: 'get', id: {} }, (err, app) => {
7474
expect(err.code).to.be.equal('act_invalid_msg');
7575
done();
7676
});
7777
});
7878
//
7979
it('should validate entities acts while promised with joi', (done) => {
80-
const app = seneca.export('cd-organisations/acts').event;
80+
const app = seneca.export('cd-organisations/acts').org;
8181
app.get({ id: {} })
8282
.catch((err) => {
8383
expect(err.code).to.be.equal('act_invalid_msg');
@@ -86,7 +86,8 @@ describe('cp-organisations-service-controller', () => {
8686
});
8787
//
8888
it('should validate controllers acts with joi', (done) => {
89-
seneca.act({ role: 'cd-organisations', ctrl: 'auth', cmd: 'authorize', dojoId: {} }, (err, app) => {
89+
seneca.act({ role: 'cd-organisations', ctrl: 'org', cmd: 'create', org: {} }, (err, app) => {
90+
console.log(err, app);
9091
expect(err.code).to.be.equal('act_invalid_msg');
9192
done();
9293
});

0 commit comments

Comments
 (0)