forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_client.lua
More file actions
52 lines (42 loc) · 1.29 KB
/
test_client.lua
File metadata and controls
52 lines (42 loc) · 1.29 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 child_helper = require("tests.child_helper")
local child = child_helper.new_child_neovim("test_client")
local u = require("tests.utils")
local T = MiniTest.new_set({
hooks = {
pre_once = function() end,
pre_case = function()
child.run_pre_case()
child.lua("s = require('copilot.status')")
child.lua("c = require('copilot.client')")
end,
post_once = child.stop,
},
})
T["client.config()"] = MiniTest.new_set()
T["client.config()"]["config, github-enterprise populated"] = function()
child.lua([[M.setup({
auth_provider_url = "https://someurl.com",
})]])
local settings = child.lua("return vim.inspect(c.config.settings)")
u.expect_match(settings, "{.*github%-enterprise.*{.*uri.*https://someurl%.com.*}.*}")
end
T["client()"] = MiniTest.new_set()
T["client()"]["status info"] = function()
child.configure_copilot()
child.cmd("Copilot status")
local messages = child.lua([[
local messages = ""
local function has_passed()
messages = vim.api.nvim_exec("messages", { output = true }) or ""
if messages:find(".*Online.*Enabled.*") then
return true
end
end
vim.wait(30000, function()
return has_passed()
end, 50)
return messages
]])
u.expect_match(messages, ".*Online.*Enabled.*")
end
return T