feature(cloudcmd) add ability to disable console with "--no-console" (#65)

This commit is contained in:
coderaiser 2016-11-09 15:57:44 +02:00
parent 6b26b26115
commit c3c008ff72
12 changed files with 79 additions and 14 deletions

37
test/console.js Normal file
View file

@ -0,0 +1,37 @@
'use strict';
const test = require('tape');
const io = require('socket.io-client');
const before = require('./before');
test('cloudcmd: console: enabled', (t) => {
const config = {console: true};
before(config, (port, after) => {
const socket = io(`http://localhost:${port}/console`)
socket.once('data', (data) => {
socket.close();
t.equal(data, 'client #1 console connected\n', 'should emit data event');
after();
t.end();
});
});
});
test('cloudcmd: console: disabled', (t) => {
const config = {console: false};
before(config, (port, after) => {
const socket = io(`http://localhost:${port}/console`);
socket.on('error', (error) => {
t.equal(error, 'Invalid namespace', 'should emit error');
socket.close();
after();
t.end();
});
});
});