@@ -73,6 +73,19 @@ T["get_node_version()"]["custom node command as string with spaces"] = function(
7373 eq (captured_args , { " /path to/node" , " --version" })
7474end
7575
76+ T [" get_node_version()" ][" custom node command as table" ] = function ()
77+ local captured_args = stub_process (" v20.10.0" , 0 , false , function ()
78+ local nodejs = require (" copilot.lsp.nodejs" )
79+ nodejs .setup ({ " mise" , " x" , " node@lts" , " --" , " node" })
80+
81+ local version , error = nodejs .get_node_version ()
82+
83+ eq (version , " 20.10.0" )
84+ eq (error , nil )
85+ end )
86+ eq (captured_args , { " mise" , " x" , " node@lts" , " --" , " node" , " --version" })
87+ end
88+
7689T [" get_node_version()" ][" handles vim.system failure" ] = function ()
7790 local captured_args = stub_process (" " , - 1 , true , function ()
7891 local nodejs = require (" copilot.lsp.nodejs" )
@@ -144,4 +157,11 @@ T["get_execute_command()"]["custom node command as string with spaces"] = functi
144157 eq (cmd , { " /path to/node" , nodejs .server_path , " --stdio" })
145158end
146159
160+ T [" get_execute_command()" ][" custom node command as table" ] = function ()
161+ local nodejs = require (" copilot.lsp.nodejs" )
162+ nodejs .setup ({ " mise" , " x" , " node@lts" , " --" , " node" })
163+ local cmd = nodejs .get_execute_command ()
164+ eq (cmd , { " mise" , " x" , " node@lts" , " --" , " node" , nodejs .server_path , " --stdio" })
165+ end
166+
147167return T
0 commit comments