Skip to content

Commit 6a565df

Browse files
committed
fix(tests): fix tests for pr 80
1 parent a4b397c commit 6a565df

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

lua/opencode/core.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,6 @@ function M.ensure_current_mode()
320320
-- Fallback to first available agent
321321
state.current_mode = available_agents[1]
322322
end
323-
324-
ui.render_output()
325323
end
326324
return true
327325
end

lua/opencode/ui/topbar.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ local function format_model_info()
2929
end
3030

3131
local function format_mode_info()
32-
return ' ' .. state.current_mode:upper() .. ' '
32+
return ' ' .. (state.current_mode or ''):upper() .. ' '
3333
end
3434

3535
local function get_mode_highlight()
36-
local mode = state.current_mode:lower()
36+
local mode = (state.current_mode or ''):lower()
3737
if mode == 'build' then
3838
return '%#OpencodeAgentBuild#'
3939
elseif mode == 'plan' then

tests/helpers.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function M.replay_setup()
2020
return nil
2121
end
2222

23+
state.current_mode = 'build' -- default mode for tests
2324
state.windows = ui.create_windows()
2425

2526
-- we use the event manager to dispatch events

tests/unit/core_spec.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ local function mock_api_client()
2121
get_current_project = function()
2222
return Promise.new():resolve({ id = 'test-project-id' })
2323
end,
24+
get_config = function()
25+
return Promise.new():resolve({ model = 'gpt-4' })
26+
end,
2427
}
2528
end
2629

0 commit comments

Comments
 (0)