mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-22 07:34:16 +00:00
test: coverage
This commit is contained in:
parent
e4ff4a78cc
commit
943bdecd3e
6 changed files with 271 additions and 5 deletions
|
|
@ -32,3 +32,34 @@ test('distribute: log: config', (t) => {
|
|||
}, {
|
||||
checkAssertionsCount: false,
|
||||
});
|
||||
|
||||
|
||||
test('distribute: log: stringToRGB', (t) => {
|
||||
const result = log.stringToRGB('abc');
|
||||
|
||||
t.deepEqual(result, [97, 3, 294], 'should return [charCode, length, crc]');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('distribute: log: makeColor', (t) => {
|
||||
const result = log.makeColor('hello');
|
||||
|
||||
t.ok(result.includes('hello'), 'should return colored string containing the input');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('distribute: log: getDescription', (t) => {
|
||||
const message = 'some error';
|
||||
const result = log.getDescription({
|
||||
message,
|
||||
});
|
||||
|
||||
t.equal(result, message, 'should return message from error object');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('distribute: log: connectedStr', (t) => {
|
||||
t.ok(log.connectedStr, 'should have connectedStr');
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,3 +54,17 @@ test('cloudcmd: server: env: bool: number: 0', (t) => {
|
|||
t.notOk(result);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: server: env: bool: zero uppercase', (t) => {
|
||||
const {CLOUDCMD_TERMINAL} = process.env;
|
||||
|
||||
process.env.CLOUDCMD_TERMINAL = '0';
|
||||
|
||||
const result = env.bool('terminal');
|
||||
|
||||
process.env.CLOUDCMD_TERMINAL = CLOUDCMD_TERMINAL;
|
||||
|
||||
t.notOk(result);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -30,3 +30,22 @@ test('themes: no args', (t) => {
|
|||
t.match(themes.light, css);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('themes: production', (t) => {
|
||||
const themes = getThemes({
|
||||
isDev: false,
|
||||
});
|
||||
|
||||
t.ok(themes.dark, 'should have dark theme');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('themes: production: light', (t) => {
|
||||
const themes = getThemes({
|
||||
isDev: false,
|
||||
});
|
||||
|
||||
t.ok(themes.light, 'should have light theme');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue