forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_health.lua
More file actions
52 lines (46 loc) · 1.24 KB
/
Copy pathtest_health.lua
File metadata and controls
52 lines (46 loc) · 1.24 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
local eq = MiniTest.expect.equality
local child_helper = require("tests.child_helper")
local child = child_helper.new_child_neovim("test_health")
local T = MiniTest.new_set({
hooks = {
pre_once = function() end,
pre_case = function()
child.run_pre_case(true)
end,
post_once = child.stop,
},
})
T["health()"] = MiniTest.new_set()
T["health()"]["check runs without error when client is running"] = function()
child.configure_copilot()
local result = child.lua([[
local health = require("copilot.health")
local ok = pcall(health.check)
return ok
]])
eq(result, true)
end
T["health()"]["check runs without error when client is not started"] = function()
local result = child.lua([[
local health = require("copilot.health")
local ok = pcall(health.check)
return ok
]])
eq(result, true)
end
T["health()"]["check runs without error when client is disabled"] = function()
child.lua([[
local lsp = require("copilot.lsp")
lsp.setup = function(_, _) return false end
]])
child.lua([[
M.setup({ filetypes = { ["*"] = true } })
]])
local result = child.lua([[
local health = require("copilot.health")
local ok = pcall(health.check)
return ok
]])
eq(result, true)
end
return T