feature: package: @putout/plugin-cloudcmd v2.0.0: CloudCmd.loadDir() -> CloudCmd.changeDir()'

This commit is contained in:
coderaiser 2023-01-16 16:52:28 +02:00
parent 026c292bae
commit e28215ddf3
8 changed files with 25 additions and 63 deletions

View file

@ -719,9 +719,7 @@ module.exports.goToDirectory = async () => {
if (cancel)
return;
await CloudCmd.loadDir({
path,
});
await CloudCmd.changeDir(path);
};
module.exports.duplicatePanel = async () => {
@ -739,8 +737,7 @@ module.exports.duplicatePanel = async () => {
const path = getPath(isDir);
await CloudCmd.loadDir({
path,
await CloudCmd.changeDir(path, {
panel,
noCurrent,
});
@ -760,14 +757,12 @@ module.exports.swapPanels = async () => {
let currentIndex = files.indexOf(element);
await CloudCmd.loadDir({
path,
await CloudCmd.changeDir(path, {
panel: panelPassive,
noCurrent: true,
});
await CloudCmd.loadDir({
path: dirPathPassive,
await CloudCmd.changeDir(dirPathPassive, {
panel,
});

View file

@ -11,10 +11,10 @@ global.CloudCmd = {};
test('cloudcmd: client: dom: goToDirectory', async (t) => {
const path = '';
const {CloudCmd} = global;
const loadDir = stub();
const changeDir = stub();
const prompt = stub().returns([null, path]);
CloudCmd.loadDir = loadDir;
CloudCmd.changeDir = changeDir;
mockRequire('./dialog', {
prompt,
@ -26,7 +26,7 @@ test('cloudcmd: client: dom: goToDirectory', async (t) => {
stopAll();
t.calledWith(loadDir, [{path}]);
t.calledWith(changeDir, [path]);
t.end();
});