mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
fix(client) dom: goToDirectory
This commit is contained in:
parent
ddef087328
commit
546b511a9a
2 changed files with 830 additions and 800 deletions
1598
client/dom/index.js
1598
client/dom/index.js
File diff suppressed because it is too large
Load diff
32
client/dom/index.spec.js
Normal file
32
client/dom/index.spec.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
require('css-modules-require-hook');
|
||||
|
||||
const {test, stub} = require('supertape');
|
||||
const mockRequire = require('mock-require');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
global.CloudCmd = {};
|
||||
|
||||
test('cloudcmd: client: dom: goToDirectory', async (t) => {
|
||||
const path = '';
|
||||
const {CloudCmd} = global;
|
||||
const loadDir = stub();
|
||||
const prompt = stub().returns([null, path]);
|
||||
|
||||
CloudCmd.loadDir = loadDir;
|
||||
|
||||
mockRequire('./dialog', {
|
||||
prompt,
|
||||
});
|
||||
|
||||
const {goToDirectory} = reRequire('.');
|
||||
|
||||
await goToDirectory();
|
||||
|
||||
stopAll();
|
||||
|
||||
t.calledWith(loadDir, [{path}]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue