From b18b6af4dc3c3a7726ad252150b12d53eba503c5 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 21 Dec 2020 15:18:42 +0200 Subject: [PATCH] feature(package) supertape v3.10.0 --- .cloudcmd.menu.js | 4 +-- client/cloudcmd.js | 4 +-- client/dom/current-file.spec.js | 12 ++++---- client/dom/dom-tree.spec.js | 4 +-- client/dom/index.js | 8 +++--- client/dom/io/index.spec.js | 2 +- client/dom/operations/rename-current.spec.js | 4 +-- client/dom/storage.spec.js | 6 ++-- client/key/vim/index.spec.js | 30 ++++++++++---------- client/key/vim/vim.spec.js | 6 ++-- client/listeners/index.js | 18 ++++++------ client/modules/config/index.js | 4 +-- client/modules/edit-file.js | 4 +-- client/modules/edit-names.js | 4 +-- client/modules/operation/index.js | 2 +- client/modules/polyfill.spec.js | 2 +- client/modules/user-menu/run.spec.js | 2 +- client/modules/view.js | 2 +- client/sw/register.js | 2 +- client/sw/register.spec.js | 6 ++-- package.json | 2 +- server/config.js | 4 +-- server/exit.spec.js | 6 ++-- server/markdown/index.js | 4 +-- server/root.spec.js | 2 +- server/terminal.spec.js | 2 +- server/validate.spec.js | 10 +++---- static/user-menu.spec.js | 10 +++---- test/common/btoa.js | 2 +- test/server/modulas.js | 2 +- 30 files changed, 86 insertions(+), 84 deletions(-) diff --git a/.cloudcmd.menu.js b/.cloudcmd.menu.js index 95b6fa2b..c7308610 100644 --- a/.cloudcmd.menu.js +++ b/.cloudcmd.menu.js @@ -28,10 +28,10 @@ module.exports = { await run(TerminalRun, 'npm run build:client:dev'); CloudCmd.refresh(); }, - 'P - Build Prod': ({CloudCmd}) => { + 'P - Build Prod': async ({CloudCmd}) => { const {TerminalRun} = CloudCmd; - run(TerminalRun, 'npm run build:client'); + await run(TerminalRun, 'npm run build:client'); CloudCmd.refresh(); }, }; diff --git a/client/cloudcmd.js b/client/cloudcmd.js index a1bcdacb..854bcf06 100644 --- a/client/cloudcmd.js +++ b/client/cloudcmd.js @@ -18,7 +18,7 @@ const { // prevent additional loading of emitify window.Emitify = require('emitify'); -module.exports = window.CloudCmd = (config) => { +module.exports = window.CloudCmd = async (config) => { window.Util = require('../common/util'); window.CloudFunc = require('../common/cloudfunc'); @@ -27,7 +27,7 @@ module.exports = window.CloudCmd = (config) => { window.DOM = DOM; window.CloudCmd = require('./client'); - register(config); + await register(config); require('./listeners'); require('./key'); diff --git a/client/dom/current-file.spec.js b/client/dom/current-file.spec.js index 22441b36..f96271bc 100644 --- a/client/dom/current-file.spec.js +++ b/client/dom/current-file.spec.js @@ -24,7 +24,7 @@ test('current-file: setCurrentName: setAttribute', (t) => { currentFile.setCurrentName('hello', current); - t.ok(setAttribute.calledWith('data-name', 'js-file-aGVsbG8='), 'should call setAttribute'); + t.calledWith(setAttribute, ['data-name', 'js-file-aGVsbG8='], 'should call setAttribute'); global.DOM = DOM; global.CloudCmd = CloudCmd; @@ -46,7 +46,7 @@ test('current-file: setCurrentName: setAttribute: cyrillic', (t) => { currentFile.setCurrentName('ай', current); - t.ok(setAttribute.calledWith('data-name', 'js-file-JUQwJUIwJUQwJUI5'), 'should call setAttribute'); + t.calledWith(setAttribute, ['data-name', 'js-file-JUQwJUIwJUQwJUI5'], 'should call setAttribute'); global.DOM = DOM; global.CloudCmd = CloudCmd; @@ -71,7 +71,7 @@ test('current-file: emit', (t) => { currentFile.setCurrentName('hello', current); - t.ok(emit.calledWith('current-file', current), 'should call emit'); + t.calledWith(emit, ['current-file', current], 'should call emit'); global.DOM = DOM; global.CloudCmd = CloudCmd; @@ -164,7 +164,7 @@ test('current-file: isCurrentFile', (t) => { global.DOM = DOM; global.CloudCmd = CloudCmd; - t.ok(isContainClass.calledWith(current, _CURRENT_FILE), 'should call isContainClass'); + t.calledWith(isContainClass, [current, _CURRENT_FILE], 'should call isContainClass'); t.end(); }); @@ -190,7 +190,7 @@ test('current-file: getCurrentType', (t) => { global.DOM = DOM; global.CloudCmd = CloudCmd; - t.ok(getByDataName.calledWith('js-type', current)); + t.calledWith(getByDataName, ['js-type', current]); t.end(); }); @@ -212,7 +212,7 @@ test('current-file: isCurrentIsDir: getCurrentType', (t) => { global.DOM = DOM; global.CloudCmd = CloudCmd; - t.ok(getCurrentType.calledWith(current)); + t.calledWith(getCurrentType, [current]); t.end(); }); diff --git a/client/dom/dom-tree.spec.js b/client/dom/dom-tree.spec.js index 5090b28c..c59239ae 100644 --- a/client/dom/dom-tree.spec.js +++ b/client/dom/dom-tree.spec.js @@ -25,7 +25,7 @@ test('dom: isContainClass: contains', (t) => { const className = 'hello'; isContainClass(el, className); - t.ok(contains.calledWith(className), 'should call contains'); + t.calledWith(contains, [className], 'should call contains'); t.end(); }); @@ -40,7 +40,7 @@ test('dom: isContainClass: contains: array', (t) => { 'hello', ]); - t.ok(contains.calledWith(className), 'should call contains'); + t.calledWith(contains, [className], 'should call contains'); t.end(); }); diff --git a/client/dom/index.js b/client/dom/index.js index 3a095892..d3f0141d 100644 --- a/client/dom/index.js +++ b/client/dom/index.js @@ -69,8 +69,8 @@ function CmdProto() { * create new folder * */ - this.promptNewDir = function() { - promptNew('directory'); + this.promptNewDir = async function() { + await promptNew('directory'); }; /** @@ -79,8 +79,8 @@ function CmdProto() { * @typeName * @type */ - this.promptNewFile = () => { - promptNew('file'); + this.promptNewFile = async () => { + await promptNew('file'); }; async function promptNew(typeName) { diff --git a/client/dom/io/index.spec.js b/client/dom/io/index.spec.js index ffe6ad4f..23f002c0 100644 --- a/client/dom/io/index.spec.js +++ b/client/dom/io/index.spec.js @@ -22,6 +22,6 @@ test('client: dom: io', (t) => { url: '/fs/hello?dir', }; - t.ok(sendRequest.calledWith(expected)); + t.calledWith(sendRequest, [expected]); t.end(); }); diff --git a/client/dom/operations/rename-current.spec.js b/client/dom/operations/rename-current.spec.js index c90a29c8..f438fa94 100644 --- a/client/dom/operations/rename-current.spec.js +++ b/client/dom/operations/rename-current.spec.js @@ -18,7 +18,7 @@ test('cloudcmd: client: dom: renameCurrent: isCurrentFile', async (t) => { const renameCurrent = reRequire('./rename-current'); await renameCurrent(current); - t.ok(isCurrentFile.calledWith(current), 'should call isCurrentFile'); + t.calledWith(isCurrentFile, [current], 'should call isCurrentFile'); t.end(); }); @@ -55,7 +55,7 @@ test('cloudcmd: client: dom: renameCurrent: file exist', async (t) => { const expected = 'Directory "hello" already exists. Proceed?'; global.CloudCmd = CloudCmd; - t.ok(confirm.calledWith(expected), 'should call confirm'); + t.calledWith(confirm, [expected], 'should call confirm'); t.end(); }); diff --git a/client/dom/storage.spec.js b/client/dom/storage.spec.js index bb73cfcb..84fdfe71 100644 --- a/client/dom/storage.spec.js +++ b/client/dom/storage.spec.js @@ -17,7 +17,7 @@ test('cloudcmd: client: storage: set', async (t) => { await storage.set('hello', 'world'); global.localStorage = localStorage; - t.ok(setItem.calledWith('hello', 'world'), 'should call setItem'); + t.calledWith(setItem, ['hello', 'world'], 'should call setItem'); t.end(); }); @@ -70,7 +70,7 @@ test('cloudcmd: client: storage: setJson', async (t) => { await storage.setJson('hello', data); global.localStorage = localStorage; - t.ok(setItem.calledWith('hello', expected)); + t.calledWith(setItem, ['hello', expected]); t.end(); }); @@ -85,7 +85,7 @@ test('cloudcmd: client: storage: remove', async (t) => { await storage.remove('hello'); global.localStorage = localStorage; - t.ok(removeItem.calledWith('hello'), 'should call removeItem'); + t.calledWith(removeItem, ['hello'], 'should call removeItem'); t.end(); }); diff --git a/client/key/vim/index.spec.js b/client/key/vim/index.spec.js index 93a35816..675a8e63 100644 --- a/client/key/vim/index.spec.js +++ b/client/key/vim/index.spec.js @@ -36,7 +36,7 @@ test('cloudcmd: client: key: set next file: no', (t) => { vim('j', {}); - t.ok(setCurrentFile.calledWith(element), 'should set next file'); + t.calledWith(setCurrentFile, [element], 'should set next file'); t.end(); }); @@ -53,7 +53,7 @@ test('cloudcmd: client: key: set next file current', (t) => { vim('j', {}); - t.ok(setCurrentFile.calledWith(nextSibling), 'should set next file'); + t.calledWith(setCurrentFile, [nextSibling], 'should set next file'); t.end(); }); @@ -73,7 +73,7 @@ test('cloudcmd: client: key: set next file current', (t) => { vim('j', {}); vim('j', {}); - t.ok(setCurrentFile.calledWith(nextSibling), 'should set next file'); + t.calledWith(setCurrentFile, [nextSibling], 'should set next file'); t.end(); }); @@ -92,7 +92,7 @@ test('cloudcmd: client: key: set next file current: g', (t) => { vim('g', {}); vim('j', {}); - t.ok(setCurrentFile.calledWith(nextSibling), 'should ignore g'); + t.calledWith(setCurrentFile, [nextSibling], 'should ignore g'); t.end(); }); @@ -116,7 +116,7 @@ test('cloudcmd: client: key: set +2 file current', (t) => { vim('2', event); vim('j', event); - t.ok(setCurrentFile.calledWith(last), 'should set next file'); + t.calledWith(setCurrentFile, [last], 'should set next file'); t.end(); }); @@ -144,7 +144,7 @@ test('cloudcmd: client: key: select +2 files from current before delete', (t) => vim('2', event); vim('j', event); - t.ok(setCurrentFile.calledWith(last), 'should set next file'); + t.calledWith(setCurrentFile, [last], 'should set next file'); t.end(); }); @@ -172,7 +172,7 @@ test('cloudcmd: client: key: delete +2 files from current', (t) => { vim('2', event); vim('j', event); - t.ok(show.calledWith('delete'), 'should call delete'); + t.calledWith(show, ['delete'], 'should call delete'); t.end(); }); @@ -190,7 +190,7 @@ test('cloudcmd: client: key: set previous file current', (t) => { vim('k', {}); - t.ok(setCurrentFile.calledWith(previousSibling), 'should set previous file'); + t.calledWith(setCurrentFile, [previousSibling], 'should set previous file'); t.end(); }); @@ -266,7 +266,7 @@ test('cloudcmd: client: key: selectFile', (t) => { vim.selectFile(current); - t.ok(selectFile.calledWith(current), 'should call selectFile'); + t.calledWith(selectFile, [current], 'should call selectFile'); t.end(); }); @@ -286,7 +286,7 @@ test('cloudcmd: client: key: set last file current: shift + g', (t) => { vim('G', {}); - t.ok(setCurrentFile.calledWith(last), 'should set last file'); + t.calledWith(setCurrentFile, [last], 'should set last file'); t.end(); }); @@ -307,7 +307,7 @@ test('cloudcmd: client: key: set last file current: $', (t) => { vim('$', {}); - t.ok(setCurrentFile.calledWith(last), 'should set last file'); + t.calledWith(setCurrentFile, [last], 'should set last file'); t.end(); }); @@ -330,7 +330,7 @@ test('cloudcmd: client: key: set first file current: gg', (t) => { vim('g', {}); vim('g', {}); - t.ok(setCurrentFile.calledWith(first), 'should set first file'); + t.calledWith(setCurrentFile, [first], 'should set first file'); t.end(); }); @@ -352,7 +352,7 @@ test('cloudcmd: client: key: set first file current: ^', (t) => { vim('^', {}); - t.ok(setCurrentFile.calledWith(first), 'should set first file'); + t.calledWith(setCurrentFile, [first], 'should set first file'); t.end(); }); @@ -368,7 +368,7 @@ test('cloudcmd: client: key: visual', (t) => { vim('v', {}); - t.ok(toggleSelectedFile.calledWith(element), 'should toggle selection'); + t.calledWith(toggleSelectedFile, [element], 'should toggle selection'); t.end(); }); @@ -403,7 +403,7 @@ test('cloudcmd: client: key: Enter', (t) => { vim('j'); - t.ok(setCurrentFile.calledWith(nextSibling), 'should set next file'); + t.calledWith(setCurrentFile, [nextSibling], 'should set next file'); t.end(); }); diff --git a/client/key/vim/vim.spec.js b/client/key/vim/vim.spec.js index ecafb8a3..f39552ee 100644 --- a/client/key/vim/vim.spec.js +++ b/client/key/vim/vim.spec.js @@ -25,7 +25,7 @@ test('vim: ^', (t) => { isDelete: false, }; - t.ok(movePrevious.calledWith(expected), 'should call movePrevious'); + t.calledWith(movePrevious, [expected], 'should call movePrevious'); t.end(); }); @@ -42,7 +42,7 @@ test('vim: w', (t) => { isDelete: false, }; - t.ok(moveNext.calledWith(expected), 'should call moveNext'); + t.calledWith(moveNext, [expected], 'should call moveNext'); t.end(); }); @@ -59,7 +59,7 @@ test('vim: b', (t) => { isDelete: false, }; - t.ok(movePrevious.calledWith(expected), 'should call movePrevious'); + t.calledWith(movePrevious, [expected], 'should call movePrevious'); t.end(); }); diff --git a/client/listeners/index.js b/client/listeners/index.js index cf0044bb..3e4be322 100644 --- a/client/listeners/index.js +++ b/client/listeners/index.js @@ -17,14 +17,16 @@ const {FS} = require('../../common/cloudfunc'); const NBSP_REG = RegExp(String.fromCharCode(160), 'g'); const SPACE = ' '; -module.exports.init = () => { - contextMenu(); - dragndrop(); - unload(); - pop(); - resize(); - config(); - header(); +module.exports.init = async () => { + await Promise.all([ + contextMenu(), + dragndrop(), + unload(), + pop(), + resize(), + header(), + config(), + ]); }; CloudCmd.Listeners = module.exports; diff --git a/client/modules/config/index.js b/client/modules/config/index.js index 61cb3eaa..38963929 100644 --- a/client/modules/config/index.js +++ b/client/modules/config/index.js @@ -238,13 +238,13 @@ function onNameChange(name) { })); } -function onKey({keyCode, target}) { +async function onKey({keyCode, target}) { switch(keyCode) { case Key.ESC: return hide(); case Key.ENTER: - return onChange(target); + return await onChange(target); } } diff --git a/client/modules/edit-file.js b/client/modules/edit-file.js index 361173be..ecde15c7 100644 --- a/client/modules/edit-file.js +++ b/client/modules/edit-file.js @@ -24,9 +24,9 @@ let MSG_CHANGED; const isLoading = fullstore(); const ConfigView = { - beforeClose: () => { + beforeClose: async () => { exec.ifExist(Menu, 'hide'); - isChanged(); + await isChanged(); }, }; diff --git a/client/modules/edit-names.js b/client/modules/edit-names.js index 2e6ee405..ed71e90e 100644 --- a/client/modules/edit-names.js +++ b/client/modules/edit-names.js @@ -20,10 +20,10 @@ const rename = currify(_rename); let Menu; const ConfigView = { - beforeClose: () => { + beforeClose: async () => { exec.ifExist(Menu, 'hide'); DOM.Events.remove('keydown', keyListener); - isChanged(); + await isChanged(); }, }; diff --git a/client/modules/operation/index.js b/client/modules/operation/index.js index 66e91494..2a308abb 100644 --- a/client/modules/operation/index.js +++ b/client/modules/operation/index.js @@ -67,7 +67,7 @@ module.exports.init = promisify((callback) => { } = CloudCmd; await loadAll(); - initOperations(prefix, prefixSocket, callback); + await initOperations(prefix, prefixSocket, callback); }, (callback) => { Loaded = true; diff --git a/client/modules/polyfill.spec.js b/client/modules/polyfill.spec.js index af2fbce6..ec2a17ac 100644 --- a/client/modules/polyfill.spec.js +++ b/client/modules/polyfill.spec.js @@ -26,6 +26,6 @@ test('cloudcmd: client: polyfill: scrollIntoViewIfNeaded', (t) => { block: 'nearest', }]; - t.ok(scroll.calledWith(...args), 'should call scrollIntoViewIfNeaded'); + t.calledWith(scroll, args, 'should call scrollIntoViewIfNeaded'); t.end(); }); diff --git a/client/modules/user-menu/run.spec.js b/client/modules/user-menu/run.spec.js index e2f18b47..98165ec6 100644 --- a/client/modules/user-menu/run.spec.js +++ b/client/modules/user-menu/run.spec.js @@ -17,7 +17,7 @@ test('cloudcmd: client: user menu: run', async (t) => { await runSelected(selected, items, runUserMenu); - t.ok(runUserMenu.calledWith(fn)); + t.calledWith(runUserMenu, [fn]); t.end(); }); diff --git a/client/modules/view.js b/client/modules/view.js index f9124a80..b000c356 100644 --- a/client/modules/view.js +++ b/client/modules/view.js @@ -130,7 +130,7 @@ async function show(data, options) { return viewImage(prefixURL); case 'media': - return viewMedia(path); + return await viewMedia(path); case 'pdf': return viewPDF(path); diff --git a/client/sw/register.js b/client/sw/register.js index 90c307f7..f1af5d14 100644 --- a/client/sw/register.js +++ b/client/sw/register.js @@ -17,7 +17,7 @@ async function registerSW(prefix) { if (!isHTTPS && !isLocalhost) return; - return navigator.serviceWorker.register(`${prefix}/sw.js`); + return await navigator.serviceWorker.register(`${prefix}/sw.js`); } async function unregisterSW(prefix) { const reg = await registerSW(prefix); diff --git a/client/sw/register.spec.js b/client/sw/register.spec.js index 883d4959..7b5cb98f 100644 --- a/client/sw/register.spec.js +++ b/client/sw/register.spec.js @@ -18,7 +18,7 @@ test('sw: listen', (t) => { listenSW(sw, 'hello', 'world'); - t.ok(addEventListener.calledWith('hello', 'world'), 'should call addEventListener'); + t.calledWith(addEventListener, ['hello', 'world'], 'should call addEventListener'); t.end(); }); @@ -78,7 +78,7 @@ test('sw: register: registerSW', async (t, {location, navigator}) => { await registerSW('/hello'); - t.ok(register.calledWith('/hello/sw.js'), 'should call register'); + t.calledWith(register, ['/hello/sw.js'], 'should call register'); t.end(); }); @@ -94,7 +94,7 @@ test('sw: register: unregisterSW', async (t, {location, navigator}) => { await unregisterSW('/hello'); - t.ok(register.calledWith('/hello/sw.js'), 'should call register'); + t.calledWith(register, ['/hello/sw.js'], 'should call register'); t.end(); }); diff --git a/package.json b/package.json index bf79f45e..94a75a8d 100644 --- a/package.json +++ b/package.json @@ -215,7 +215,7 @@ "smalltalk": "^4.0.0", "style-loader": "^1.0.0", "supermenu": "^4.0.1", - "supertape": "^3.1.3", + "supertape": "^3.10.0", "tar-stream": "^2.0.0", "unionfs": "^4.0.0", "url-loader": "^4.0.0", diff --git a/server/config.js b/server/config.js index 30dcf71b..84866cfa 100644 --- a/server/config.js +++ b/server/config.js @@ -157,7 +157,7 @@ function listen(manage, sock, auth) { }); } -function _middle(manage, req, res, next) { +async function _middle(manage, req, res, next) { const noConfigDialog = !manage('configDialog'); if (req.url !== `${apiURL}/config`) @@ -174,7 +174,7 @@ function _middle(manage, req, res, next) { .status(404) .send('Config is disabled'); - patch(manage, req, res); + await patch(manage, req, res); break; default: diff --git a/server/exit.spec.js b/server/exit.spec.js index 85ee3a94..432773ee 100644 --- a/server/exit.spec.js +++ b/server/exit.spec.js @@ -9,7 +9,7 @@ test('cloudcmd: exit: process.exit', (t) => { process.exit = stub(); exit(); - t.ok(process.exit.calledWith(1), 'should call process.exit'); + t.calledWith(process.exit, [1], 'should call process.exit'); process.exit = exitOriginal; t.end(); @@ -23,7 +23,7 @@ test('cloudcmd: exit: console.error', (t) => { process.exit = stub(); exit('hello world'); - t.ok(console.error.calledWith('hello world'), 'should call console.error'); + t.calledWith(console.error, ['hello world'], 'should call console.error'); process.exit = exitOriginal; console.error = error; @@ -39,7 +39,7 @@ test('cloudcmd: exit.error: console.error: error', (t) => { process.exit = stub(); exit(Error('hello world')); - t.ok(console.error.calledWith('hello world'), 'should call console.error'); + t.calledWith(console.error, ['hello world'], 'should call console.error'); process.exit = exitOriginal; console.error = error; diff --git a/server/markdown/index.js b/server/markdown/index.js index 47acd8b8..0906d57e 100644 --- a/server/markdown/index.js +++ b/server/markdown/index.js @@ -26,10 +26,10 @@ module.exports = callbackify(async (name, rootDir, request) => { switch(method) { case 'GET': - return onGET(request, name, rootDir); + return await onGET(request, name, rootDir); case 'PUT': - return onPUT(request); + return await onPUT(request); } }); diff --git a/server/root.spec.js b/server/root.spec.js index a8c65079..300cb234 100644 --- a/server/root.spec.js +++ b/server/root.spec.js @@ -29,7 +29,7 @@ test('cloudcmd: root: mellow', (t) => { mockRequire.stopAll(pathConfig); reRequire(pathRoot); - t.ok(pathToWin.calledWith(dir, dirRoot), 'should call mellow'); + t.calledWith(pathToWin, [dir, dirRoot], 'should call mellow'); t.end(); }); diff --git a/server/terminal.spec.js b/server/terminal.spec.js index 2b6d8f99..0acacb67 100644 --- a/server/terminal.spec.js +++ b/server/terminal.spec.js @@ -38,7 +38,7 @@ test('cloudcmd: terminal: enabled', (t) => { const terminal = require(terminalPath); terminal(arg); - t.ok(term.calledWith(arg), 'should call terminal'); + t.calledWith(term, [arg], 'should call terminal'); t.end(); }); diff --git a/server/validate.spec.js b/server/validate.spec.js index a82fe004..595b47b5 100644 --- a/server/validate.spec.js +++ b/server/validate.spec.js @@ -33,7 +33,7 @@ test('validate: root: config', (t) => { validate.root('/hello', config); - t.ok(config.calledWith('dropbox'), 'should call config'); + t.calledWith(config, ['dropbox'], 'should call config'); t.end(); }); @@ -64,7 +64,7 @@ test('validate: root: stat', (t) => { fs.statSync = statSync; mockRequire.stop(exitPath); - t.ok(fn.calledWith(msg, error), 'should call fn'); + t.calledWith(fn, [msg, error], 'should call fn'); t.end(); }); @@ -80,7 +80,7 @@ test('validate: packer: not valid', (t) => { mockRequire.stop(exitPath); - t.ok(fn.calledWith(msg), 'should call fn'); + t.calledWith(fn, [msg], 'should call fn'); t.end(); }); @@ -96,7 +96,7 @@ test('validate: editor: not valid', (t) => { mockRequire.stop(exitPath); - t.ok(fn.calledWith(msg), 'should call fn'); + t.calledWith(fn, [msg], 'should call fn'); t.end(); }); @@ -131,7 +131,7 @@ test('validate: columns: wrong', (t) => { mockRequire.stop(exitPath); mockRequire.stop(columnsPath); - t.ok(fn.calledWith(msg), 'should call exit'); + t.calledWith(fn, [msg], 'should call exit'); t.end(); }); diff --git a/static/user-menu.spec.js b/static/user-menu.spec.js index aa2aeda2..a1b196a0 100644 --- a/static/user-menu.spec.js +++ b/static/user-menu.spec.js @@ -41,7 +41,7 @@ test('cloudcmd: static: user menu: IO.write', async (t) => { }); const path = '/.cloudcmd.menu.js'; - t.ok(write.calledWith(path, _data), 'should call IO.write'); + t.calledWith(write, [path, _data], 'should call IO.write'); t.end(); }); @@ -72,7 +72,7 @@ test('cloudcmd: static: user menu: setCurrentByName', async (t) => { }); const fileName = '.cloudcmd.menu.js'; - t.ok(setCurrentByName.calledWith(fileName), 'should call DOM.setCurrentByName'); + t.calledWith(setCurrentByName, [fileName], 'should call DOM.setCurrentByName'); t.end(); }); @@ -120,7 +120,7 @@ test('cloudcmd: static: user menu: compare directories', async (t) => { }); const {files} = DOM.CurrentInfo.files; - t.ok(DOM.getFilenames.calledWith(files), 'should call getFilenames'); + t.calledWith(DOM.getFilenames, [files], 'should call getFilenames'); t.end(); }); @@ -138,7 +138,7 @@ test('cloudcmd: static: user menu: compare directories: select names', (t) => { getCurrentByName, }); - t.ok(selectFile.calledWith(file), 'should call selectFile'); + t.calledWith(selectFile, [file], 'should call selectFile'); t.end(); }); @@ -156,7 +156,7 @@ test('cloudcmd: static: user menu: compare directories: select names: getCurrent getCurrentByName, }); - t.ok(getCurrentByName.calledWith(name, panel), 'should call selectFile'); + t.calledWith(getCurrentByName, [name, panel], 'should call selectFile'); t.end(); }); diff --git a/test/common/btoa.js b/test/common/btoa.js index 9a82d5e4..3239ec55 100644 --- a/test/common/btoa.js +++ b/test/common/btoa.js @@ -13,7 +13,7 @@ test('btoa: browser', (t) => { btoa(str); - t.ok(global.btoa.calledWith(str), 'should call global.btoa'); + t.calledWith(global.btoa, [str], 'should call global.btoa'); t.end(); global.btoa = btoaOriginal; diff --git a/test/server/modulas.js b/test/server/modulas.js index d9aa464f..d8fc7e90 100644 --- a/test/server/modulas.js +++ b/test/server/modulas.js @@ -74,7 +74,7 @@ test('cloudcmd: modules: no', (t) => { fn({url}, {send}); - t.ok(send.calledWith(localModules), 'should have been called with modules'); + t.calledWith(send, [localModules], 'should have been called with modules'); t.end(); });