mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
test(terminal) coverage
This commit is contained in:
parent
ea7219f37b
commit
d98156faed
2 changed files with 28 additions and 1 deletions
|
|
@ -179,6 +179,7 @@
|
|||
"jshint": "^2.8.0",
|
||||
"minor": "^1.2.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mock-require": "^2.0.2",
|
||||
"morgan": "^1.6.1",
|
||||
"nodemon": "^1.9.1",
|
||||
"nsp": "^2.2.1",
|
||||
|
|
@ -207,4 +208,4 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"main": "legacy/server/cloudcmd.js"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('tape');
|
||||
const mock = require('mock-require');
|
||||
const diff = require('sinon-called-with-diff');
|
||||
const sinon = diff(require('sinon'));
|
||||
|
||||
|
|
@ -58,6 +59,31 @@ test('cloudcmd: terminal: enabled', (t) => {
|
|||
console.log = log;
|
||||
|
||||
clean(configPath);
|
||||
require(configPath);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: terminal: no arg', (t) => {
|
||||
const gritty = {};
|
||||
|
||||
mock('gritty', gritty);
|
||||
|
||||
clean(terminalPath);
|
||||
stub(configPath, (a) => {
|
||||
if (a === 'terminal')
|
||||
return true;
|
||||
|
||||
return 'gritty';
|
||||
});
|
||||
|
||||
const terminal = require(terminalPath);
|
||||
const result = terminal();
|
||||
|
||||
t.equal(result, gritty, 'should equal');
|
||||
|
||||
clean(configPath);
|
||||
require(configPath);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue