Skip to content

Commit 52964e6

Browse files
committed
add gemini_cli test
1 parent 373baf2 commit 52964e6

File tree

3 files changed

+74
-288
lines changed

3 files changed

+74
-288
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
local h = require("tests.helpers")
2+
local adapter
3+
4+
local new_set = MiniTest.new_set
5+
T = new_set()
6+
7+
T["Gemini CLI adapter"] = new_set({
8+
hooks = {
9+
pre_case = function()
10+
adapter = require("codecompanion.adapters").resolve("gemini_cli")
11+
end,
12+
},
13+
})
14+
15+
T["Gemini CLI adapter"]["only sends fresh user messages to the LLM"] = function()
16+
local messages = {
17+
{
18+
_meta = {
19+
sent = true,
20+
},
21+
content = "Can you explain Ruby in two words?",
22+
role = "user",
23+
},
24+
{
25+
_meta = {},
26+
content = "Dynamic. Elegant",
27+
role = "llm",
28+
},
29+
{
30+
_meta = {},
31+
content = "Awesome! Thanks",
32+
role = "user",
33+
},
34+
}
35+
36+
local output = {
37+
{
38+
text = "Awesome! Thanks",
39+
type = "text",
40+
},
41+
}
42+
43+
h.eq(output, adapter.handlers.form_messages(adapter, messages))
44+
end
45+
46+
T["Gemini CLI adapter"]["can form multiple messages to be sent"] = function()
47+
local messages = {
48+
{
49+
_meta = {},
50+
content = "Can you explain Ruby in two words?",
51+
role = "user",
52+
},
53+
{
54+
_meta = {},
55+
content = "Make it snappy",
56+
role = "user",
57+
},
58+
}
59+
60+
local output = {
61+
{
62+
text = "Can you explain Ruby in two words?",
63+
type = "text",
64+
},
65+
{
66+
text = "Make it snappy",
67+
type = "text",
68+
},
69+
}
70+
71+
h.eq(output, adapter.handlers.form_messages(adapter, messages))
72+
end
73+
74+
return T

tests/adapters/acp/testing_codex.lua

Lines changed: 0 additions & 150 deletions
This file was deleted.

tests/adapters/acp/testing_gemini_cli.lua

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)