mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
chore(cloudcmd) lint
This commit is contained in:
parent
85015881d0
commit
3172759ca0
6 changed files with 10 additions and 0 deletions
|
|
@ -8,12 +8,14 @@ const {isContainClass} = require('./dom-tree');
|
||||||
|
|
||||||
test('dom: isContainClass: no element', (t) => {
|
test('dom: isContainClass: no element', (t) => {
|
||||||
const [e] = tryCatch(isContainClass);
|
const [e] = tryCatch(isContainClass);
|
||||||
|
|
||||||
t.equal(e.message, 'element could not be empty!', 'should throw when no element');
|
t.equal(e.message, 'element could not be empty!', 'should throw when no element');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dom: isContainClass: no className', (t) => {
|
test('dom: isContainClass: no className', (t) => {
|
||||||
const [e] = tryCatch(isContainClass, {});
|
const [e] = tryCatch(isContainClass, {});
|
||||||
|
|
||||||
t.equal(e.message, 'className could not be empty!', 'should throw when no element');
|
t.equal(e.message, 'className could not be empty!', 'should throw when no element');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ test('common: datetime: no arg', (t) => {
|
||||||
datetime();
|
datetime();
|
||||||
|
|
||||||
global.Date = Date;
|
global.Date = Date;
|
||||||
|
|
||||||
t.ok(called, 'should call new Date');
|
t.ok(called, 'should call new Date');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ test('config: middle: no', (t) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
middle(req, res, next);
|
middle(req, res, next);
|
||||||
|
|
||||||
t.ok(next.calledWith(), 'should call next');
|
t.ok(next.calledWith(), 'should call next');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ test('rest: isRootAll', (t) => {
|
||||||
|
|
||||||
test('rest: onPUT: no args', async (t) => {
|
test('rest: onPUT: no args', async (t) => {
|
||||||
const [e] = await tryToCatch(_onPUT, {});
|
const [e] = await tryToCatch(_onPUT, {});
|
||||||
|
|
||||||
t.equal(e.message, 'name should be a string!', 'should throw when no args');
|
t.equal(e.message, 'name should be a string!', 'should throw when no args');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ test('validate: root: bad', (t) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const [e] = tryCatch(cloudcmd, {config});
|
const [e] = tryCatch(cloudcmd, {config});
|
||||||
|
|
||||||
t.equal(e.message, 'dir should be a string', 'should throw');
|
t.equal(e.message, 'dir should be a string', 'should throw');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
@ -64,6 +65,7 @@ test('validate: root: stat', (t) => {
|
||||||
fs.statSync = statSync;
|
fs.statSync = statSync;
|
||||||
|
|
||||||
mockRequire.stop(exitPath);
|
mockRequire.stop(exitPath);
|
||||||
|
|
||||||
t.calledWith(fn, [msg, error], 'should call fn');
|
t.calledWith(fn, [msg, error], 'should call fn');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ test('cloudcmd: static: user menu: IO.write', async (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const path = '/.cloudcmd.menu.js';
|
const path = '/.cloudcmd.menu.js';
|
||||||
|
|
||||||
t.calledWith(write, [path, _data], 'should call IO.write');
|
t.calledWith(write, [path, _data], 'should call IO.write');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
@ -72,6 +73,7 @@ test('cloudcmd: static: user menu: setCurrentByName', async (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileName = '.cloudcmd.menu.js';
|
const fileName = '.cloudcmd.menu.js';
|
||||||
|
|
||||||
t.calledWith(setCurrentByName, [fileName], 'should call DOM.setCurrentByName');
|
t.calledWith(setCurrentByName, [fileName], 'should call DOM.setCurrentByName');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
@ -120,6 +122,7 @@ test('cloudcmd: static: user menu: compare directories', async (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const {files} = DOM.CurrentInfo.files;
|
const {files} = DOM.CurrentInfo.files;
|
||||||
|
|
||||||
t.calledWith(DOM.getFilenames, [files], 'should call getFilenames');
|
t.calledWith(DOM.getFilenames, [files], 'should call getFilenames');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue