diff --git a/server/rest.js b/server/rest.js index b14294b1..00790fd4 100644 --- a/server/rest.js +++ b/server/rest.js @@ -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; diff --git a/test/server/rest.js b/test/server/rest.js index 723550b3..db29618e 100644 --- a/test/server/rest.js +++ b/test/server/rest.js @@ -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(); +}); +