chore(cloudcmd) update dependencies

This commit is contained in:
coderaiser 2020-12-04 18:47:24 +02:00
parent 4c7f8cc6b6
commit c719e37cc1
5 changed files with 37 additions and 21 deletions

View file

@ -1,6 +1,8 @@
'use strict';
const test = require('supertape');
const tryCatch = require('try-catch');
const datetime = require('./datetime');
test('common: datetime', (t) => {
@ -9,7 +11,7 @@ test('common: datetime', (t) => {
const expected = '2018.08.17 10:56:48';
t.equals(result, expected, 'should equal');
t.equal(result, expected, 'should equal');
t.end();
});
@ -39,14 +41,15 @@ test('common: 0 before number', (t) => {
const expected = '2018.08.17 10:56:08';
t.equals(result, expected, 'should equal');
t.equal(result, expected, 'should equal');
t.end();
});
test('common: datetime: wrong args', (t) => {
const fn = () => datetime({});
const [error] = tryCatch(datetime, {});
t.throws(fn, /date should be instanceof Date!/, 'should throw');
t.equal(error.message, 'date should be instanceof Date!', 'should throw');
t.end();
});

View file

@ -2,7 +2,9 @@
const test = require('supertape');
const {reRequire} = require('mock-require');
const tryCatch = require('try-catch');
const Util = require('./util');
const {
findObjByNameInArr,
getRegExp,
@ -35,13 +37,16 @@ test('util: getExt: no name', (t) => {
});
test('util: findObjByNameInArr: no array', (t) => {
t.throws(findObjByNameInArr, /array should be array!/, 'should throw when no array');
const [error] = tryCatch(findObjByNameInArr);
t.equal(error.message, 'array should be array!', 'should throw when no array');
t.end();
});
test('util: findObjByNameInArr: no name', (t) => {
const fn = () => findObjByNameInArr([]);
t.throws(fn, /name should be string!/, 'should throw when no name');
const [error] = tryCatch(findObjByNameInArr, []);
t.equal(error.message, 'name should be string!', 'should throw when no array');
t.end();
});