@@ -8,6 +8,52 @@ 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 : "manifest default with trailing slash" ,
25+ defaultBaseURL : "http://localhost:3000/" ,
26+ want : "http://localhost:3000" ,
27+ },
28+ {
29+ name : "configured override" ,
30+ defaultBaseURL : "http://localhost:3000" ,
31+ overrideBaseURL : "http://localhost:4000/" ,
32+ want : "http://localhost:4000" ,
33+ },
34+ }
35+
36+ for _ , tt := range tests {
37+ t .Run (tt .name , func (t * testing.T ) {
38+ cliData := api.CLIData {
39+ BaseURLDefault : tt .defaultBaseURL ,
40+ Steps : []api.CLIStep {{
41+ CLICommand : & api.CLIStepCLICommand {
42+ Command : `echo '${baseURL}'` ,
43+ },
44+ }},
45+ }
46+ messages := make (chan tea.Msg , 10 )
47+
48+ results := CLIChecks (cliData , tt .overrideBaseURL , messages )
49+
50+ if got := results [0 ].CLICommandResult .Stdout ; got != tt .want {
51+ t .Fatalf ("command stdout = %q, want %q" , got , tt .want )
52+ }
53+ })
54+ }
55+ }
56+
1157func TestApplySubmissionResultsMarksAllStepsAndTestsPassedWhenNoFailure (t * testing.T ) {
1258 cliData := api.CLIData {Steps : []api.CLIStep {
1359 {CLICommand : & api.CLIStepCLICommand {Tests : []api.CLICommandTest {{}, {}}}},
0 commit comments