mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-17 16:38:18 +00:00
chore: cloudcmd: actions: lint ☘️
This commit is contained in:
parent
943bdecd3e
commit
7f28803a82
5 changed files with 51 additions and 20 deletions
|
|
@ -50,7 +50,9 @@ test('dom: isContainClass: contains: array', (t) => {
|
||||||
|
|
||||||
test('dom: getByTag', (t) => {
|
test('dom: getByTag', (t) => {
|
||||||
const getElementsByTagName = stub();
|
const getElementsByTagName = stub();
|
||||||
const element = {getElementsByTagName};
|
const element = {
|
||||||
|
getElementsByTagName,
|
||||||
|
};
|
||||||
|
|
||||||
getByTag('div', element);
|
getByTag('div', element);
|
||||||
|
|
||||||
|
|
@ -60,7 +62,9 @@ test('dom: getByTag', (t) => {
|
||||||
|
|
||||||
test('dom: getById', (t) => {
|
test('dom: getById', (t) => {
|
||||||
const querySelector = stub();
|
const querySelector = stub();
|
||||||
const element = {querySelector};
|
const element = {
|
||||||
|
querySelector,
|
||||||
|
};
|
||||||
|
|
||||||
getById('my-id', element);
|
getById('my-id', element);
|
||||||
|
|
||||||
|
|
@ -70,7 +74,9 @@ test('dom: getById', (t) => {
|
||||||
|
|
||||||
test('dom: getByClassAll', (t) => {
|
test('dom: getByClassAll', (t) => {
|
||||||
const getElementsByClassName = stub();
|
const getElementsByClassName = stub();
|
||||||
const element = {getElementsByClassName};
|
const element = {
|
||||||
|
getElementsByClassName,
|
||||||
|
};
|
||||||
|
|
||||||
getByClassAll('my-class', element);
|
getByClassAll('my-class', element);
|
||||||
|
|
||||||
|
|
@ -91,7 +97,9 @@ test('dom: getByClass: calls getByClassAll', (t) => {
|
||||||
|
|
||||||
test('dom: getByDataName', (t) => {
|
test('dom: getByDataName', (t) => {
|
||||||
const querySelector = stub();
|
const querySelector = stub();
|
||||||
const element = {querySelector};
|
const element = {
|
||||||
|
querySelector,
|
||||||
|
};
|
||||||
|
|
||||||
getByDataName('hello', element);
|
getByDataName('hello', element);
|
||||||
|
|
||||||
|
|
@ -102,7 +110,9 @@ test('dom: getByDataName', (t) => {
|
||||||
test('dom: hide', (t) => {
|
test('dom: hide', (t) => {
|
||||||
const add = stub();
|
const add = stub();
|
||||||
const element = {
|
const element = {
|
||||||
classList: {add},
|
classList: {
|
||||||
|
add,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
hide(element);
|
hide(element);
|
||||||
|
|
@ -114,7 +124,9 @@ test('dom: hide', (t) => {
|
||||||
test('dom: show', (t) => {
|
test('dom: show', (t) => {
|
||||||
const remove = stub();
|
const remove = stub();
|
||||||
const element = {
|
const element = {
|
||||||
classList: {remove},
|
classList: {
|
||||||
|
remove,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
show(element);
|
show(element);
|
||||||
|
|
@ -127,7 +139,9 @@ test('dom: getByClassAll: without element uses document', (t) => {
|
||||||
const getElementsByClassName = stub();
|
const getElementsByClassName = stub();
|
||||||
const prevDocument = globalThis.document;
|
const prevDocument = globalThis.document;
|
||||||
|
|
||||||
globalThis.document = {getElementsByClassName};
|
globalThis.document = {
|
||||||
|
getElementsByClassName,
|
||||||
|
};
|
||||||
|
|
||||||
getByClassAll('my-class');
|
getByClassAll('my-class');
|
||||||
|
|
||||||
|
|
@ -136,4 +150,3 @@ test('dom: getByClassAll: without element uses document', (t) => {
|
||||||
t.calledWith(getElementsByClassName, ['my-class'], 'should fallback to document when no element');
|
t.calledWith(getElementsByClassName, ['my-class'], 'should fallback to document when no element');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import {convert, getName, getValue, setValue} from './input.js';
|
import {
|
||||||
|
convert,
|
||||||
|
getName,
|
||||||
|
getValue,
|
||||||
|
setValue,
|
||||||
|
} from './input.js';
|
||||||
|
|
||||||
test('cloudcmd: client: config: input: convert', (t) => {
|
test('cloudcmd: client: config: input: convert', (t) => {
|
||||||
const result = convert({
|
const result = convert({
|
||||||
|
|
@ -42,7 +47,9 @@ test('cloudcmd: client: config: input: convert: bool false', (t) => {
|
||||||
|
|
||||||
test('cloudcmd: client: config: input: getName', (t) => {
|
test('cloudcmd: client: config: input: getName', (t) => {
|
||||||
const getAttribute = stub().returns('js-hello');
|
const getAttribute = stub().returns('js-hello');
|
||||||
const element = {getAttribute};
|
const element = {
|
||||||
|
getAttribute,
|
||||||
|
};
|
||||||
|
|
||||||
const result = getName(element);
|
const result = getName(element);
|
||||||
|
|
||||||
|
|
@ -55,7 +62,10 @@ test('cloudcmd: client: config: input: getValue: checkbox', (t) => {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
checked: true,
|
checked: true,
|
||||||
});
|
});
|
||||||
const element = {querySelector};
|
|
||||||
|
const element = {
|
||||||
|
querySelector,
|
||||||
|
};
|
||||||
|
|
||||||
const result = getValue('auth', element);
|
const result = getValue('auth', element);
|
||||||
|
|
||||||
|
|
@ -68,7 +78,10 @@ test('cloudcmd: client: config: input: getValue: number', (t) => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
value: '42',
|
value: '42',
|
||||||
});
|
});
|
||||||
const element = {querySelector};
|
|
||||||
|
const element = {
|
||||||
|
querySelector,
|
||||||
|
};
|
||||||
|
|
||||||
const result = getValue('port', element);
|
const result = getValue('port', element);
|
||||||
|
|
||||||
|
|
@ -81,7 +94,10 @@ test('cloudcmd: client: config: input: getValue: default', (t) => {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
value: 'hello',
|
value: 'hello',
|
||||||
});
|
});
|
||||||
const element = {querySelector};
|
|
||||||
|
const element = {
|
||||||
|
querySelector,
|
||||||
|
};
|
||||||
|
|
||||||
const result = getValue('name', element);
|
const result = getValue('name', element);
|
||||||
|
|
||||||
|
|
@ -94,8 +110,11 @@ test('cloudcmd: client: config: input: setValue: checkbox', (t) => {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
checked: false,
|
checked: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const querySelector = stub().returns(el);
|
const querySelector = stub().returns(el);
|
||||||
const element = {querySelector};
|
const element = {
|
||||||
|
querySelector,
|
||||||
|
};
|
||||||
|
|
||||||
setValue('auth', true, element);
|
setValue('auth', true, element);
|
||||||
|
|
||||||
|
|
@ -108,8 +127,11 @@ test('cloudcmd: client: config: input: setValue: default', (t) => {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
value: 'old',
|
value: 'old',
|
||||||
};
|
};
|
||||||
|
|
||||||
const querySelector = stub().returns(el);
|
const querySelector = stub().returns(el);
|
||||||
const element = {querySelector};
|
const element = {
|
||||||
|
querySelector,
|
||||||
|
};
|
||||||
|
|
||||||
setValue('name', 'new', element);
|
setValue('name', 'new', element);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ test('distribute: log: config', (t) => {
|
||||||
checkAssertionsCount: false,
|
checkAssertionsCount: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('distribute: log: stringToRGB', (t) => {
|
test('distribute: log: stringToRGB', (t) => {
|
||||||
const result = log.stringToRGB('abc');
|
const result = log.stringToRGB('abc');
|
||||||
|
|
||||||
|
|
@ -44,11 +43,10 @@ test('distribute: log: stringToRGB', (t) => {
|
||||||
test('distribute: log: makeColor', (t) => {
|
test('distribute: log: makeColor', (t) => {
|
||||||
const result = log.makeColor('hello');
|
const result = log.makeColor('hello');
|
||||||
|
|
||||||
t.ok(result.includes('hello'), 'should return colored string containing the input');
|
t.match(result, 'hello', 'should return colored string containing the input');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('distribute: log: getDescription', (t) => {
|
test('distribute: log: getDescription', (t) => {
|
||||||
const message = 'some error';
|
const message = 'some error';
|
||||||
const result = log.getDescription({
|
const result = log.getDescription({
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,3 @@ test('cloudcmd: server: env: bool: zero uppercase', (t) => {
|
||||||
t.notOk(result);
|
t.notOk(result);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,4 +48,3 @@ test('themes: production: light', (t) => {
|
||||||
t.ok(themes.light, 'should have light theme');
|
t.ok(themes.light, 'should have light theme');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue