mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
test: cloudcmd: coverage
This commit is contained in:
parent
a52a6aae62
commit
a9e29eee85
5 changed files with 303 additions and 1 deletions
28
client/key/binder.spec.js
Normal file
28
client/key/binder.spec.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import {test} from 'supertape';
|
||||
import {createBinder} from './binder.js';
|
||||
|
||||
test('client: key: binder: isBind: default', (t) => {
|
||||
const binder = createBinder();
|
||||
|
||||
t.notOk(binder.isBind(), 'should not be bind by default');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('client: key: binder: setBind', (t) => {
|
||||
const binder = createBinder();
|
||||
|
||||
binder.setBind();
|
||||
|
||||
t.ok(binder.isBind(), 'should be bind');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('client: key: binder: unsetBind', (t) => {
|
||||
const binder = createBinder();
|
||||
|
||||
binder.setBind();
|
||||
binder.unsetBind();
|
||||
|
||||
t.notOk(binder.isBind(), 'should not be bind');
|
||||
t.end();
|
||||
});
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import {test, stub} from 'supertape';
|
||||
import {getDOM, getCloudCmd} from './globals.fixture.js';
|
||||
import vim, {selectFile as vimSelectFile} from './index.js';
|
||||
import * as finder from './find.js';
|
||||
|
||||
globalThis.DOM = getDOM();
|
||||
globalThis.CloudCmd = getCloudCmd();
|
||||
|
|
@ -675,3 +676,82 @@ test('cloudcmd: client: vim: rename', async (t) => {
|
|||
t.calledWithNoArgs(renameCurrent);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: client: key: cc: operationCopy', (t) => {
|
||||
const show = stub();
|
||||
const preventDefault = stub();
|
||||
|
||||
const Operation = {
|
||||
show,
|
||||
};
|
||||
|
||||
const event = {
|
||||
preventDefault,
|
||||
};
|
||||
|
||||
vim('c', event, {
|
||||
Operation,
|
||||
});
|
||||
|
||||
vim('c', event, {
|
||||
Operation,
|
||||
});
|
||||
|
||||
t.calledWith(show, ['copy'], 'should show copy operation');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: client: key: mm: operationMove', (t) => {
|
||||
const show = stub();
|
||||
const preventDefault = stub();
|
||||
|
||||
const Operation = {
|
||||
show,
|
||||
};
|
||||
|
||||
const event = {
|
||||
preventDefault,
|
||||
};
|
||||
|
||||
vim('m', event, {
|
||||
Operation,
|
||||
});
|
||||
|
||||
vim('m', event, {
|
||||
Operation,
|
||||
});
|
||||
|
||||
t.calledWith(show, ['move'], 'should show move operation');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: client: key: n: findNext: real', (t) => {
|
||||
const setCurrentByName = stub();
|
||||
|
||||
finder.find('a', ['alpha', 'beta', 'apple']);
|
||||
|
||||
const event = {};
|
||||
|
||||
vim('n', event, {
|
||||
setCurrentByName,
|
||||
});
|
||||
|
||||
t.calledWith(setCurrentByName, ['beta'], 'should set current by next found name');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: client: key: N: findPrevious: real', (t) => {
|
||||
const setCurrentByName = stub();
|
||||
|
||||
finder.find('a', ['alpha', 'beta', 'apple']);
|
||||
|
||||
const event = {};
|
||||
|
||||
vim('N', event, {
|
||||
setCurrentByName,
|
||||
});
|
||||
|
||||
t.calledWith(setCurrentByName, ['apple'], 'should set current by previous found name');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue