@@ -8,6 +8,47 @@ import (
88 tea "github.com/charmbracelet/bubbletea"
99)
1010
11+ func TestCLIChecksInterpolatesResolvedBaseURLInCommands (t * testing.T ) {
12+ tests := []struct {
13+ name string
14+ defaultBaseURL string
15+ overrideBaseURL string
16+ want string
17+ }{
18+ {
19+ name : "manifest default" ,
20+ defaultBaseURL : "http://localhost:3000" ,
21+ want : "http://localhost:3000" ,
22+ },
23+ {
24+ name : "configured override" ,
25+ defaultBaseURL : "http://localhost:3000" ,
26+ overrideBaseURL : "http://localhost:4000" ,
27+ want : "http://localhost:4000" ,
28+ },
29+ }
30+
31+ for _ , tt := range tests {
32+ t .Run (tt .name , func (t * testing.T ) {
33+ cliData := api.CLIData {
34+ BaseURLDefault : tt .defaultBaseURL ,
35+ Steps : []api.CLIStep {{
36+ CLICommand : & api.CLIStepCLICommand {
37+ Command : `printf '%s' '${baseURL}'` ,
38+ },
39+ }},
40+ }
41+ messages := make (chan tea.Msg , 10 )
42+
43+ results := CLIChecks (cliData , tt .overrideBaseURL , messages )
44+
45+ if got := results [0 ].CLICommandResult .Stdout ; got != tt .want {
46+ t .Fatalf ("command stdout = %q, want %q" , got , tt .want )
47+ }
48+ })
49+ }
50+ }
51+
1152func TestApplySubmissionResultsMarksAllStepsAndTestsPassedWhenNoFailure (t * testing.T ) {
1253 cliData := api.CLIData {Steps : []api.CLIStep {
1354 {CLICommand : & api.CLIStepCLICommand {Tests : []api.CLICommandTest {{}, {}}}},
0 commit comments