mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(rest) coverage
This commit is contained in:
parent
fa619b59d6
commit
153e2a63e0
3 changed files with 88 additions and 52 deletions
|
|
@ -1,48 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('tape');
|
||||
const rest = require('../../server/rest');
|
||||
const {
|
||||
_formatMsg,
|
||||
_getWin32RootMsg,
|
||||
_isRootWin32,
|
||||
_isRootAll,
|
||||
} = rest;
|
||||
|
||||
test('rest: formatMsg', (t) => {
|
||||
const result = _formatMsg('hello', 'world');
|
||||
|
||||
t.equal(result, 'hello: ok("world")', 'should be equal');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('rest: formatMsg: json', (t) => {
|
||||
const result = _formatMsg('hello', {
|
||||
name: 'world',
|
||||
});
|
||||
|
||||
t.equal(result, 'hello: ok("{"name":"world"}")', 'should parse json');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('rest: getWin32RootMsg', (t) => {
|
||||
const {message} = _getWin32RootMsg();
|
||||
|
||||
t.equal(message,'Could not copy from/to root on windows!', 'should return error');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('rest: isRootWin32', (t) => {
|
||||
const result = _isRootWin32('/');
|
||||
|
||||
t.notOk(result, 'should equal');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('rest: isRootAll', (t) => {
|
||||
const result = _isRootAll(['/', '/h']);
|
||||
|
||||
t.notOk(result, 'should equal');
|
||||
t.end();
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue