Skip to content

Commit 6dd0b51

Browse files
Test: Add jest and a first test case on CLI (WIP) (#18)
Test: Add jest and a first test case on CLI
1 parent 588c3e9 commit 6dd0b51

17 files changed

Lines changed: 3027 additions & 24 deletions

.eslintrc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ module.exports = {
44
],
55
"env": {
66
"shelljs": true,
7+
"jest": true,
78
"node": true
89
},
10+
"parserOptions": {
11+
"sourceType": "script"
12+
},
913
"rules": {
1014
// TODO: change these rules to errors and fix codebase
1115
"prefer-const": 1, // 4 errors
@@ -15,6 +19,7 @@ module.exports = {
1519
"consistent-return": 1, // 8 errors
1620
"no-param-reassign": 1, // 2 errors
1721
"global-require": 1, // 2 errors
18-
"import/no-dynamic-require": 1 // 1 error
22+
"import/no-dynamic-require": 1, // 1 error
23+
"comma-dangle": ["error", "never"]
1924
}
2025
}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DS_Store
12
/node_modules
23
.latestversion
3-
npm-debug.log
4+
npm-debug.log
5+
/testAppDoNotKeep

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ language: node_js
22
cache:
33
directories:
44
- node_modules
5-
sudo: false
65
services: mongodb
76
node_js:
7+
- "8"
88
- "7"
99
- "6"
1010
- "5"

bin/dpd renamed to bin/dpd.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env node
22

3+
'use strict';
4+
35
/**
46
* External dependencies
57
*/
6-
7-
var cli = require('../lib/cli');
8-
8+
const cli = require('../lib/cli');
99

1010
cli.program
1111
.version(require('../package').version)
@@ -18,13 +18,12 @@ cli.program
1818
.option('-H, --host [host]', 'specify host for mongo server')
1919
.option('-P, --mongoPort [mongoPort]', 'mongodb port to connect to')
2020
.option('-n, --dbname [dbname]', 'name of the mongo database')
21-
.option('-a, --auth <auth>', ' usesrname:password mongo server credentials')
21+
.option('-a, --auth <auth>', ' usesrname:password mongo server credentials')
2222
.option('-u, --username <username>', 'The user to authenticate as')
23-
.option('-s, --password <password>', 'The user\'s password')
23+
.option('-s, --password <password>', 'The user\'s password')
2424
.option('-c, --dbconn <dbconnectionstring>', 'The MongoDB Connection String')
2525
.option(' --deploydPath [deploydPath]', 'allow overriding the path to deployd main script');
2626

27-
2827

2928
cli.program
3029
.command('create [project-name]')
@@ -58,4 +57,3 @@ cli.program
5857
cli.program.parse(process.argv);
5958

6059
if (cli.program.args.length === 0) cli.start();
61-

lib/cli/create.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/**
24
* External dependencies
35
*/

lib/cli/createserver.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/**
24
* External dependencies
35
*/

lib/cli/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/**
24
* External dependencies
35
*/
@@ -6,12 +8,12 @@ const program = require('commander');
68
/**
79
* Local modules
810
*/
9-
const create = require('./create'),
10-
createserver = require('./createserver'),
11-
keygen = require('./keygen'),
12-
showkey = require('./showkey'),
13-
start = require('./start'),
14-
stop = require('./stop');
11+
const create = require('./create');
12+
const createserver = require('./createserver');
13+
const keygen = require('./keygen');
14+
const showkey = require('./showkey');
15+
const start = require('./start');
16+
const stop = require('./stop');
1517

1618
/**
1719
* Export CLI modules
@@ -22,5 +24,5 @@ module.exports = {
2224
create,
2325
keygen,
2426
showkey,
25-
stop,
27+
stop
2628
};

lib/cli/keygen.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/**
24
* Generate a key
35
*/

lib/cli/showkey.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/**
24
* Show current key
35
*/

lib/cli/start.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/**
24
* External dependencies
35
*/
@@ -90,7 +92,7 @@ const start = function (file) {
9092
process.exit();
9193
}
9294
},
93-
startup,
95+
startup
9496
);
9597
}
9698

0 commit comments

Comments
 (0)