chore(cloudcmd) lint

This commit is contained in:
coderaiser 2021-12-04 01:21:02 +02:00
parent bd5a8afdd5
commit efb686c332
12 changed files with 43 additions and 29 deletions

View file

@ -112,6 +112,7 @@ test('cloudcmd: auth: reject', (t) => {
const username = 'root';
const password = 'toor';
config('auth', true);
config('username', username);
config('password', password);

View file

@ -3,7 +3,7 @@
const test = require('supertape');
const stub = require('@cloudcmd/stub');
const mockRequire = require('mock-require');
const {reRequire} = mockRequire;
const {reRequire, stopAll} = mockRequire;
const pathConfig = './config';
const pathRoot = './root';
@ -29,6 +29,8 @@ test('cloudcmd: root: mellow', (t) => {
mockRequire.stopAll(pathConfig);
reRequire(pathRoot);
stopAll();
t.calledWith(webToWin, [dir, dirRoot], 'should call mellow');
t.end();
});

View file

@ -9,6 +9,8 @@ const terminalPath = './terminal';
const terminal = require('./terminal');
const {createConfigManager} = require('./cloudcmd');
const {stopAll} = mockRequire;
test('cloudcmd: terminal: disabled', (t) => {
const config = createConfigManager();
config('terminal', false);
@ -38,6 +40,8 @@ test('cloudcmd: terminal: enabled', (t) => {
const terminal = require(terminalPath);
terminal(arg);
stopAll();
t.calledWith(term, [arg], 'should call terminal');
t.end();
});
@ -67,12 +71,13 @@ test('cloudcmd: terminal: no arg', (t) => {
mockRequire('gritty', gritty);
const config = createConfigManager();
config('terminal', true);
config('terminalPath', 'gritty');
const result = terminal(config);
mockRequire.stop('gritty');
stopAll();
t.equal(result, gritty);
t.end();

View file

@ -6,7 +6,7 @@ const test = require('supertape');
const stub = require('@cloudcmd/stub');
const tryCatch = require('try-catch');
const mockRequire = require('mock-require');
const {reRequire} = mockRequire;
const {reRequire, stopAll} = mockRequire;
const dir = '..';
@ -64,7 +64,7 @@ test('validate: root: stat', (t) => {
const msg = 'cloudcmd --root: %s';
fs.statSync = statSync;
mockRequire.stop(exitPath);
stopAll();
t.calledWith(fn, [msg, error], 'should call fn');
t.end();
@ -80,7 +80,7 @@ test('validate: packer: not valid', (t) => {
packer('hello');
mockRequire.stop(exitPath);
stopAll();
t.calledWith(fn, [msg], 'should call fn');
t.end();
@ -96,7 +96,7 @@ test('validate: editor: not valid', (t) => {
editor('hello');
mockRequire.stop(exitPath);
stopAll();
t.calledWith(fn, [msg], 'should call fn');
t.end();
@ -110,7 +110,7 @@ test('validate: columns', (t) => {
columns('name-size-date');
mockRequire.stop(exitPath);
stopAll();
t.notOk(fn.called, 'should not call exit');
t.end();
@ -130,8 +130,7 @@ test('validate: columns: wrong', (t) => {
columns('hello');
mockRequire.stop(exitPath);
mockRequire.stop(columnsPath);
stopAll();
t.calledWith(fn, [msg], 'should call exit');
t.end();