chore: cloudcmd: actions: lint ☘️

This commit is contained in:
coderaiser 2024-03-18 16:32:23 +00:00
parent 57d2f8e93d
commit 46c8accd84

View file

@ -21,13 +21,13 @@ const {
test('cloudcmd: defaults: config', (t) => {
const configManager = createConfigManager();
configManager('configDialog', false);
cloudcmd({
configManager,
});
t.notOk(configManager('configDialog'), 'should not override config with defaults');
t.end();
});
@ -35,11 +35,11 @@ test('cloudcmd: defaults: config', (t) => {
test('cloudcmd: defaults: console', (t) => {
const configManager = createConfigManager();
configManager('console', false);
cloudcmd({
configManager,
});
t.notOk(configManager('console'), 'should not override config with defaults');
t.end();
});
@ -47,7 +47,7 @@ test('cloudcmd: defaults: console', (t) => {
test('cloudcmd: getPrefix', (t) => {
const value = 'hello';
const result = _getPrefix(value);
t.equal(result, value);
t.end();
});
@ -56,7 +56,7 @@ test('cloudcmd: getPrefix: function', (t) => {
const value = 'hello';
const fn = () => value;
const result = _getPrefix(fn);
t.equal(result, value);
t.end();
});
@ -65,34 +65,34 @@ test('cloudcmd: getPrefix: function: empty', (t) => {
const value = null;
const fn = () => value;
const result = _getPrefix(fn);
t.equal(result, '');
t.end();
});
test('cloudcmd: replaceDist', (t) => {
const currentIsDev = _isDev();
_isDev(true);
const url = '/dist/hello';
const result = _replaceDist(url);
const expected = '/dist-dev/hello';
_isDev(currentIsDev);
t.equal(result, expected);
t.end();
});
test('cloudcmd: replaceDist: !isDev', (t) => {
const url = '/dist/hello';
const currentIsDev = _isDev();
_isDev(false);
const result = _replaceDist(url);
_isDev(currentIsDev);
t.equal(result, url);
t.end();
});
@ -100,18 +100,18 @@ test('cloudcmd: replaceDist: !isDev', (t) => {
test('cloudcmd: auth: reject', (t) => {
const accept = stub();
const reject = stub();
const config = createConfigManager();
const username = 'root';
const password = 'toor';
config('auth', true);
config('username', username);
config('password', password);
_initAuth(config, accept, reject, username, 'abc');
t.ok(reject.called, 'should reject');
t.end();
});
@ -119,18 +119,18 @@ test('cloudcmd: auth: reject', (t) => {
test('cloudcmd: auth: accept', (t) => {
const accept = stub();
const reject = stub();
const username = 'root';
const password = 'toor';
const auth = true;
const config = createConfigManager();
config('username', username);
config('password', password);
config('auth', auth);
_initAuth(config, accept, reject, username, password);
t.ok(accept.called, 'should accept');
t.end();
});
@ -138,18 +138,18 @@ test('cloudcmd: auth: accept', (t) => {
test('cloudcmd: auth: accept: no auth', (t) => {
const accept = stub();
const reject = stub();
const auth = false;
const username = 'root';
const password = 'toor';
const config = createConfigManager();
config('username', username);
config('password', password);
config('auth', auth);
_initAuth(config, accept, reject, username, password);
t.ok(accept.called, 'should accept');
t.end();
});
@ -157,7 +157,7 @@ test('cloudcmd: auth: accept: no auth', (t) => {
test('cloudcmd: getIndexPath: production', (t) => {
const isDev = false;
const name = path.join(__dirname, '..', 'dist', 'index.html');
t.equal(cloudcmd._getIndexPath(isDev), name);
t.end();
});
@ -165,14 +165,14 @@ test('cloudcmd: getIndexPath: production', (t) => {
test('cloudcmd: getIndexPath: development', (t) => {
const isDev = true;
const name = path.join(__dirname, '..', 'dist-dev', 'index.html');
t.equal(cloudcmd._getIndexPath(isDev), name);
t.end();
});
test('cloudcmd: sw', async (t) => {
const {status} = await request.get('/sw.js');
t.equal(status, 200, 'should return sw');
t.end();
});