test(package) gritty: terminal enabled

This commit is contained in:
coderaiser 2018-05-11 15:33:17 +03:00
parent 9c18764178
commit 9b2c276036
4 changed files with 22 additions and 6 deletions

View file

@ -173,6 +173,7 @@
"extract-text-webpack-plugin": "^4.0.0-alpha.0",
"file-loader": "^1.1.4",
"fresh-require": "^1.0.3",
"gritty": "^2.1.1",
"gunzip-maybe": "^1.3.1",
"html-looks-like": "^1.0.2",
"html-webpack-exclude-assets-plugin": "^0.0.7",

View file

@ -6,9 +6,7 @@ const config = require('./config');
const noop = () => {};
noop.listen = noop;
module.exports = (arg) => {
return getTerminal(config('terminal'), arg);
};
module.exports = (arg) => getTerminal(config('terminal'), arg);
function getTerminal(term, arg) {
if (!term)

View file

@ -243,7 +243,7 @@ test('cloudcmd: route: sendIndex: encode', async (t) => {
t.ok(data.includes(nameEncoded), 'should encode name');
clear('flop');
mockRequire.stop('flop');
clear(routePath);
clear('../../server/cloudcmd');
clear(beforePath);
@ -277,7 +277,7 @@ test('cloudcmd: route: sendIndex: encode: not encoded', async (t) => {
t.notOk(data.includes(name), 'should not put not encoded name');
clear('flop');
mockRequire.stop('flop');
clear(routePath);
clear('../../server/cloudcmd');
clear(beforePath);
@ -312,7 +312,7 @@ test('cloudcmd: route: sendIndex: ddos: render', async (t) => {
t.pass('should not hang up');
clear('flop');
mockRequire.stop('flo');
clear(routePath);
clear(cloudcmdPath);
clear(beforePath);
@ -335,3 +335,18 @@ test('cloudcmd: route: buttons: no terminal', async (t) => {
t.end();
});
test('cloudcmd: route: buttons: terminal', async (t) => {
const config = {
terminal: true,
terminalPath: 'gritty',
};
const {port, done} = await connect({config});
const result = await getStr(`http://localhost:${port}`);
t.notOk(/icon-terminal none/.test(result), 'should enable terminal');
done();
t.end();
});

View file

@ -97,6 +97,8 @@ test('cloudcmd: terminal: no arg', (t) => {
t.equal(result, gritty, 'should equal');
mock.stop('gritty');
clean(configPath);
require(configPath);