test(cloudcmd) ok -> match

This commit is contained in:
coderaiser 2021-03-09 18:41:47 +02:00
parent a091a382ca
commit 21e7ea7d4c
8 changed files with 26 additions and 15 deletions

View file

@ -6,6 +6,9 @@
"fontello.json" "fontello.json"
], ],
"match": { "match": {
"route.spec.js": {
"tape/convert-ok-to-match": "off"
},
"*.js": { "*.js": {
"convert-esm-to-commonjs": "on" "convert-esm-to-commonjs": "on"
}, },

View file

@ -1,2 +1,4 @@
'use strict'; 'use strict';
await IO.copy(dirPath, mp3Dir, mp3Names); async function copy() {
await IO.copy(dirPath, mp3Dir, mp3Names);
}

View file

@ -1,5 +1,7 @@
await IO.cp({ async function copy() {
from: dirPath, await IO.cp({
to: mp3Dir, from: dirPath,
names: mp3Names, to: mp3Dir,
}); names: mp3Names,
});
}

View file

@ -1,2 +1,4 @@
'use strict'; 'use strict';
await IO.move(dirPath, mp3Dir, mp3Names); async function move() {
await IO.move(dirPath, mp3Dir, mp3Names);
}

View file

@ -1,5 +1,7 @@
await IO.mv({ async function move() {
from: dirPath, await IO.mv({
to: mp3Dir, from: dirPath,
names: mp3Names, to: mp3Dir,
}); names: mp3Names,
});
}

View file

@ -71,7 +71,7 @@ test('cloudcmd: markdown: put: error', async (t) => {
const [e] = await tryToCatch(_markdown, name, '/', mdStream); const [e] = await tryToCatch(_markdown, name, '/', mdStream);
t.ok(e.message.includes('ENOENT: no such file or directory'), 'should emit error'); t.match(e.message, /ENOENT: no such file or directory/, 'should emit error');
t.end(); t.end();
}); });

View file

@ -221,7 +221,7 @@ test('cloudcmd: route: not found', async (t) => {
options, options,
}); });
t.ok(body.includes('ENOENT: no such file or directory'), 'should return error'); t.match(body, /ENOENT: no such file or directory/, 'should return error');
t.end(); t.end();
}); });

View file

@ -58,7 +58,7 @@ test('cloudcmd: terminal: enabled: no string', (t) => {
const msg = 'cloudcmd --terminal: Cannot find module \'hello\''; const msg = 'cloudcmd --terminal: Cannot find module \'hello\'';
const [arg] = log.args[0]; const [arg] = log.args[0];
t.ok(arg.includes(msg), 'should call with msg'); t.match(arg, RegExp(msg), 'should call with msg');
t.end(); t.end();
}); });