Skip to content

Commit e36a06c

Browse files
committed
test: add missing env field to config test fixtures
Change-Id: Icabc93ce10712b9bf37e6a43fdeabdecef2e1780 Signed-off-by: Thomas Kosiewski <[email protected]>
1 parent fbfe201 commit e36a06c

File tree

2 files changed

+14
-32
lines changed

2 files changed

+14
-32
lines changed

tests/config_test.lua

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -175,34 +175,24 @@ describe("Config module", function()
175175
assert(type(config.defaults.track_selection) == "boolean")
176176
end)
177177

178-
it("should validate valid configuration", function()
179-
local valid_config = {
180-
port_range = { min = 10000, max = 65535 },
181-
auto_start = true,
178+
it("should apply and validate user configuration", function()
179+
local user_config = {
182180
terminal_cmd = "toggleterm",
183181
log_level = "debug",
184182
track_selection = false,
185-
visual_demotion_delay_ms = 50,
186-
connection_wait_delay = 200,
187-
connection_timeout = 10000,
188-
queue_timeout = 5000,
189-
diff_opts = {
190-
auto_close_on_accept = true,
191-
show_diff_stats = true,
192-
vertical_split = true,
193-
open_in_current_tab = true,
194-
},
195183
models = {
196184
{ name = "Claude Opus 4 (Latest)", value = "claude-opus-4-20250514" },
197185
{ name = "Claude Sonnet 4 (Latest)", value = "claude-sonnet-4-20250514" },
198186
},
199187
}
200188

201-
local success, _ = pcall(function()
202-
return config.validate(valid_config)
189+
local success, final_config = pcall(function()
190+
return config.apply(user_config)
203191
end)
204192

205193
assert(success == true)
194+
assert(final_config.env ~= nil) -- Should inherit default empty table
195+
assert(type(final_config.env) == "table")
206196
end)
207197

208198
it("should merge user config with defaults", function()

tests/unit/config_spec.lua

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,22 @@ describe("Configuration", function()
2525
expect(config.defaults).to_have_key("models")
2626
end)
2727

28-
it("should validate valid configuration", function()
29-
local valid_config = {
30-
port_range = { min = 10000, max = 65535 },
31-
auto_start = true,
28+
it("should apply and validate user configuration", function()
29+
local user_config = {
3230
terminal_cmd = "toggleterm",
3331
log_level = "debug",
3432
track_selection = false,
35-
visual_demotion_delay_ms = 50,
36-
connection_wait_delay = 200,
37-
connection_timeout = 10000,
38-
queue_timeout = 5000,
39-
diff_opts = {
40-
auto_close_on_accept = true,
41-
show_diff_stats = true,
42-
vertical_split = true,
43-
open_in_current_tab = true,
44-
},
4533
models = {
4634
{ name = "Test Model", value = "test-model" },
4735
},
4836
}
4937

50-
local success = config.validate(valid_config)
51-
expect(success).to_be_true()
38+
local final_config = config.apply(user_config)
39+
expect(final_config).to_be_table()
40+
expect(final_config.terminal_cmd).to_be("toggleterm")
41+
expect(final_config.log_level).to_be("debug")
42+
expect(final_config.track_selection).to_be_false()
43+
expect(final_config.env).to_be_table() -- Should inherit default empty table
5244
end)
5345

5446
it("should reject invalid port range", function()

0 commit comments

Comments
 (0)