test(rest) isRootAll: coverage

This commit is contained in:
coderaiser 2018-02-23 16:22:14 +02:00
parent cd1fe7db29
commit cd0fad79e8
2 changed files with 12 additions and 5 deletions

View file

@ -246,7 +246,7 @@ function extract(from, to, fn) {
from = root(from);
if (to)
to = root(to);
to = root(to);
else
to = from.replace(/\.tar\.gz$/, '');
@ -351,10 +351,9 @@ function isRootWin32(path) {
return isWin32 && isRoot && isConfig;
}
module.exports._isRootAll = isRootAll;
function isRootAll(names) {
return names.some((name) => {
return isRootWin32(name);
});
return names.some(isRootWin32);
}
module.exports._getWin32RootMsg = getWin32RootMsg;

View file

@ -6,6 +6,7 @@ const {
_formatMsg,
_getWin32RootMsg,
_isRootWin32,
_isRootAll,
} = rest;
test('rest: formatMsg', (t) => {
@ -25,7 +26,7 @@ test('rest: formatMsg: json', (t) => {
});
test('rest: getWin32RootMsg', (t) => {
const {message}= _getWin32RootMsg();
const {message} = _getWin32RootMsg();
t.equal(message,'Could not copy from/to root on windows!', 'should return error');
t.end();
@ -38,3 +39,10 @@ test('rest: isRootWin32', (t) => {
t.end();
});
test('rest: isRootAll', (t) => {
const result = _isRootAll(['/', '/h']);
t.notOk(result, 'should equal');
t.end();
});