chore(cloudcmd) lint

This commit is contained in:
coderaiser 2021-10-19 15:59:57 +03:00
parent 85015881d0
commit 3172759ca0
6 changed files with 10 additions and 0 deletions

View file

@ -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();
}); });

View file

@ -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();
}); });

View file

@ -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();
}); });

View file

@ -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();
}); });

View file

@ -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();
}); });

View file

@ -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();
}); });