File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -487,4 +487,35 @@ describe('opencode.api', function()
487487 config_file .get_user_commands = original_get_user_commands
488488 end )
489489 end )
490+
491+ describe (' current_model' , function ()
492+ it (' returns the current model from state' , function ()
493+ local original_model = state .current_model
494+ state .current_model = ' testmodel'
495+
496+ local model = api .current_model ()
497+ assert .equal (' testmodel' , model )
498+
499+ state .current_model = original_model
500+ end )
501+
502+ it (' falls back to config file model when state.current_model is nil' , function ()
503+ local original_model = state .current_model
504+ state .current_model = nil
505+
506+ local config_file = require (' opencode.config_file' )
507+ local original_get_opencode_config = config_file .get_opencode_config
508+
509+ config_file .get_opencode_config = function ()
510+ return { model = ' testmodel' }
511+ end
512+
513+ local model = api .current_model ()
514+
515+ assert .equal (' testmodel' , model )
516+
517+ config_file .get_opencode_config = original_get_opencode_config
518+ state .current_model = original_model
519+ end )
520+ end )
490521end )
You can’t perform that action at this time.
0 commit comments