test(rest) getWin32RootMsg

This commit is contained in:
coderaiser 2017-10-23 18:12:17 +03:00
parent 38291f1fc3
commit 35b954ab46
2 changed files with 12 additions and 2 deletions

View file

@ -356,6 +356,8 @@ function isRootAll(names) {
});
}
module.exports._getWin32RootMsg = getWin32RootMsg;
function getWin32RootMsg() {
const message = 'Could not copy from/to root on windows!';
const error = Error(message);

View file

@ -4,12 +4,13 @@ const test = require('tape');
const rest = require('../../server/rest');
const {
_formatMsg,
_getWin32RootMsg,
} = rest;
test('rest: formatMsg', (t) => {
const result = _formatMsg('hello', 'world');
t.equal(result, 'hello: ok("world")');
t.equal(result, 'hello: ok("world")', 'should be equal');
t.end();
});
@ -18,7 +19,14 @@ test('rest: formatMsg: json', (t) => {
name: 'world',
});
t.equal(result, 'hello: ok("{"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();
});