mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
36 lines
979 B
JavaScript
36 lines
979 B
JavaScript
'use strict';
|
|
|
|
const test = require('tape');
|
|
const showConfig = require('../../server/show-config');
|
|
|
|
test('cloudcmd: show-config: no arguments', (t) => {
|
|
t.throws(showConfig, /config could not be empty!/, 'should throw when no config');
|
|
t.end();
|
|
});
|
|
|
|
test('cloudcmd: show-config: bad arguments', (t) => {
|
|
const fn = () => showConfig('hello');
|
|
t.throws(fn, /config should be an object!/, 'should throw when config not object');
|
|
t.end();
|
|
});
|
|
|
|
test('cloudcmd: show-config: return', (t) => {
|
|
t.equal(showConfig({}), '', 'should return string');
|
|
t.end();
|
|
});
|
|
|
|
test('cloudcmd: show-config: return', (t) => {
|
|
const config = {
|
|
hello: 'world'
|
|
};
|
|
|
|
const result = [
|
|
'+-------+--------------------------------+\n',
|
|
'| hello | world |\n',
|
|
'+-------+--------------------------------+\n',
|
|
].join('');
|
|
|
|
t.equal(showConfig(config), result, 'should return table');
|
|
t.end();
|
|
});
|
|
|