mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(cloudcmd) add ability to disable console with "--no-console" (#65)
This commit is contained in:
parent
6b26b26115
commit
c3c008ff72
12 changed files with 79 additions and 14 deletions
37
test/console.js
Normal file
37
test/console.js
Normal 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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue