test(terminal) coverage

This commit is contained in:
coderaiser 2017-07-11 13:56:11 +03:00
parent ea7219f37b
commit d98156faed
2 changed files with 28 additions and 1 deletions

View file

@ -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"
}
}

View file

@ -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();
});