-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_spec.lua
More file actions
41 lines (35 loc) · 1.18 KB
/
Copy pathconfig_spec.lua
File metadata and controls
41 lines (35 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local input = require "input"
local config = require "input.config"
describe("Config options", function()
it("could be indexed without options field", function()
assert.equal("", config.icon)
assert.equal("Input", config.default_prompt)
end)
end)
describe("Override config", function()
local expected = {
icon = "",
default_prompt = "Select",
win_config = {
relative = "editor",
anchor = "SE",
border = "rounded",
},
}
input.setup(expected)
it("should change default config", function()
local function tbl_contains(table, value)
return vim.tbl_contains(table, function(v)
for k, _ in pairs(value) do
if v[k] ~= value[k] then
return false
end
end
return true
end, { predicate = true })
end
assert.equal(expected.icon, config.icon)
assert.equal(expected.default_prompt, config.default_prompt)
assert.is_true(tbl_contains({ config.win_config }, { relative = "editor", anchor = "SE", border = "rounded" }))
end)
end)