forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_command.lua
More file actions
65 lines (55 loc) · 2.08 KB
/
test_command.lua
File metadata and controls
65 lines (55 loc) · 2.08 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local child_helper = require("tests.child_helper")
local child = child_helper.new_child_neovim("test_command")
local u = require("tests.utils")
local reference_screenshot = MiniTest.expect.reference_screenshot
local T = MiniTest.new_set({
hooks = {
pre_once = function() end,
pre_case = function()
child.run_pre_case(true)
child.bo.readonly = false
end,
post_once = child.stop,
},
})
T["command()"] = MiniTest.new_set()
T["command()"]["version works"] = function()
child.configure_copilot()
child.cmd("Copilot version")
local result = child.cmd_capture("mess")
u.expect_match(result, ".*copilot language server.*copilot%.lua.*mocked.*")
end
T["command()"]["panel toggle - open works"] = function()
child.configure_copilot()
child.cmd("Copilot panel toggle")
reference_screenshot(child.get_screenshot(), nil, { ignore_text = { 23, 24 }, ignore_attr = { 23, 24 } })
end
T["command()"]["panel toggle - close works"] = function()
child.configure_copilot()
child.cmd("Copilot panel toggle")
child.cmd("Copilot panel toggle")
reference_screenshot(child.get_screenshot(), nil, { ignore_text = { 23, 24 }, ignore_attr = { 23, 24 } })
end
T["command()"]["panel open - it works"] = function()
child.configure_copilot()
child.cmd("Copilot panel open")
reference_screenshot(child.get_screenshot(), nil, { ignore_text = { 23, 24 }, ignore_attr = { 23, 24 } })
end
T["command()"]["panel close - it works"] = function()
child.configure_copilot()
child.cmd("Copilot panel open")
child.cmd("Copilot panel close")
reference_screenshot(child.get_screenshot(), nil, { ignore_text = { 23, 24 }, ignore_attr = { 23, 24 } })
end
T["command()"]["panel is_open - is opened - returns true"] = function()
child.configure_copilot()
child.cmd("Copilot panel open")
local is_open = child.cmd_capture("Copilot panel is_open")
u.expect_match(is_open, "true")
end
T["command()"]["panel is_open - is closed - returns false"] = function()
child.configure_copilot()
local is_open = child.cmd_capture("Copilot panel is_open")
u.expect_match(is_open, "false")
end
return T