Add keyBind tests.
This commit is contained in:
parent
c4918b9704
commit
5342429193
1 changed files with 66 additions and 1 deletions
|
@ -12,6 +12,12 @@ let
|
|||
builder = "test";
|
||||
system = "test";
|
||||
};
|
||||
minBind = {
|
||||
bind = "<leader>";
|
||||
cmd = null;
|
||||
cmdIsFunction = false;
|
||||
opts = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
helpers = {
|
||||
|
@ -41,7 +47,66 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
getKey = { };
|
||||
getKey = {
|
||||
testBind = {
|
||||
expr = lazyUtils.helpers.getKey minBind;
|
||||
expected = [
|
||||
minBind.bind
|
||||
];
|
||||
};
|
||||
testCmd = {
|
||||
expr = lazyUtils.helpers.getKey (minBind // { cmd = "testCmd"; });
|
||||
expected = [
|
||||
minBind.bind
|
||||
"testCmd"
|
||||
];
|
||||
};
|
||||
testFnNoCmd = {
|
||||
expr = lazyUtils.helpers.getKey (minBind // { cmdIsFunction = true; });
|
||||
expected = [
|
||||
minBind.bind
|
||||
];
|
||||
};
|
||||
testFn = {
|
||||
expr =
|
||||
let
|
||||
result = lazyUtils.helpers.getKey (
|
||||
minBind
|
||||
// {
|
||||
cmd = "testCmd";
|
||||
cmdIsFunction = true;
|
||||
}
|
||||
);
|
||||
in
|
||||
assert builtins.isFunction (builtins.elemAt result 1);
|
||||
map (val: if builtins.isFunction val then val null else val) result;
|
||||
expected = [
|
||||
minBind.bind
|
||||
"testCmd"
|
||||
];
|
||||
};
|
||||
testOpts = {
|
||||
expr = lazyUtils.helpers.getKey (
|
||||
minBind
|
||||
// {
|
||||
opts = {
|
||||
description = "A test keybind.";
|
||||
};
|
||||
}
|
||||
);
|
||||
expected = [
|
||||
minBind.bind
|
||||
{
|
||||
__unpack = true;
|
||||
description = "A test keybind.";
|
||||
}
|
||||
];
|
||||
};
|
||||
testInvalid = {
|
||||
expr = lazyUtils.helpers.getKey (minBind // { cmdIsFunction = null; });
|
||||
expectedError.type = "AssertionError";
|
||||
};
|
||||
};
|
||||
pluginWrapper = {
|
||||
testShort = {
|
||||
expr = lazyUtils.helpers.pluginWrapper "test";
|
||||
|
|
Loading…
Reference in a new issue