mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-17 16:38:18 +00:00
test: coverage
This commit is contained in:
parent
92c79830f5
commit
a52a6aae62
2 changed files with 47 additions and 1 deletions
|
|
@ -32,6 +32,8 @@ const UserError = (msg) => {
|
|||
return error;
|
||||
};
|
||||
|
||||
export const _UserError = UserError;
|
||||
|
||||
export default currify(({config, fs = _fs, moveFiles = _moveFiles}, request, response, next) => {
|
||||
const name = ponse.getPathName(request);
|
||||
const regExp = RegExp(`^${apiURL}`);
|
||||
|
|
@ -153,6 +155,8 @@ function getPackReg(packer) {
|
|||
return /\.tar\.gz$/;
|
||||
}
|
||||
|
||||
export const _getPackReg = getPackReg;
|
||||
|
||||
function streamPack(cmd, response, packer) {
|
||||
const noop = () => {};
|
||||
const filename = cmd.replace(getPackReg(packer), '');
|
||||
|
|
@ -172,6 +176,8 @@ function getCMD(cmd) {
|
|||
return cmd;
|
||||
}
|
||||
|
||||
export const _getCMD = getCMD;
|
||||
|
||||
const getMoveMsg = (names) => formatMsg('move', names);
|
||||
|
||||
const getRenameMsg = (from, to) => {
|
||||
|
|
@ -276,6 +282,8 @@ function rename(rootDir, from, to, fs, callback) {
|
|||
return fs.rename(fromRooted, toRooted, fn);
|
||||
}
|
||||
|
||||
export const _rename = rename;
|
||||
|
||||
function pack(from, to, names, config, fn) {
|
||||
const rootDir = config('root');
|
||||
const packer = config('packer');
|
||||
|
|
@ -294,6 +302,8 @@ function pack(from, to, names, config, fn) {
|
|||
operation('pack', packer, from, to, names, fn);
|
||||
}
|
||||
|
||||
export const _pack = pack;
|
||||
|
||||
function extract(from, to, config, fn) {
|
||||
const rootDir = config('root');
|
||||
|
||||
|
|
@ -307,6 +317,8 @@ function extract(from, to, config, fn) {
|
|||
operation('extract', config('packer'), from, to, fn);
|
||||
}
|
||||
|
||||
export const _extract = extract;
|
||||
|
||||
function getPacker(operation, packer) {
|
||||
if (operation === 'extract')
|
||||
return inly;
|
||||
|
|
@ -317,6 +329,8 @@ function getPacker(operation, packer) {
|
|||
return jaguar.pack;
|
||||
}
|
||||
|
||||
export const _getPacker = getPacker;
|
||||
|
||||
function operation(op, packer, from, to, names, fn) {
|
||||
if (!fn) {
|
||||
fn = names;
|
||||
|
|
@ -345,6 +359,8 @@ function operation(op, packer, from, to, names, fn) {
|
|||
});
|
||||
}
|
||||
|
||||
export const _operation = operation;
|
||||
|
||||
function copy(from, to, names, fn) {
|
||||
copymitter(from, to, names)
|
||||
.on('error', fn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue