(t *testing.T)
| 78 | } |
| 79 | |
| 80 | func TestCLIAvailableVariables(t *testing.T) { |
| 81 | result := api.CLICommandResult{ |
| 82 | Variables: map[string]string{ |
| 83 | "url": "http://localhost:42069", |
| 84 | }, |
| 85 | Command: api.CLIStepCLICommand{ |
| 86 | Command: "curl ${url}", |
| 87 | Tests: []api.CLICommandTest{ |
| 88 | {StdoutContainsAll: []string{"${expected}"}}, |
| 89 | }, |
| 90 | }, |
| 91 | } |
| 92 | |
| 93 | available, expectsVariables := availableVariablesForCLIResult(result) |
| 94 | if !expectsVariables { |
| 95 | t.Fatalf("expected CLI command to use variables") |
| 96 | } |
| 97 | got := renderVariableSection("Variables Available", available) |
| 98 | |
| 99 | if !strings.Contains(got, "url: http://localhost:42069 (Command)") { |
| 100 | t.Fatalf("expected url entry in:\n%s", got) |
| 101 | } |
| 102 | if !strings.Contains(got, "expected: [not found] (Stdout Contains Test)") { |
| 103 | t.Fatalf("expected missing expected entry in:\n%s", got) |
| 104 | } |
| 105 | } |
nothing calls this directly
no test coverage detected