Skip to content

Commit 8e84f55

Browse files
committed
fix formatter
1 parent 3e4534b commit 8e84f55

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

cli/formatters/transaction_run.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ type TransactionRunOutput struct {
3232

3333
func (f transactionRun) Format(output TransactionRunOutput, format Output) string {
3434
output.RunWebURL = f.getRunLink(output.Transaction.GetId(), output.Run.GetId())
35+
3536
switch format {
36-
case Pretty:
37-
return f.pretty(output)
3837
case JSON:
3938
return f.json(output)
39+
case Pretty, "":
40+
return f.pretty(output)
4041
}
4142

4243
return ""
@@ -77,16 +78,14 @@ func (f transactionRun) json(output TransactionRunOutput) string {
7778
}
7879

7980
func (f transactionRun) pretty(output TransactionRunOutput) string {
81+
message := fmt.Sprintf("%s %s (%s)\n", PASSED_TEST_ICON, output.Transaction.GetName(), output.RunWebURL)
8082
if !output.HasResults {
81-
return ""
83+
return f.getColoredText(true, message)
8284
}
8385

84-
link := output.RunWebURL
8586
allStepsPassed := f.allTransactionStepsPassed(output)
86-
message := fmt.Sprintf("%s %s (%s)\n", PASSED_TEST_ICON, output.Transaction.GetName(), link)
87-
8887
if !allStepsPassed {
89-
message = fmt.Sprintf("%s %s (%s)\n", FAILED_TEST_ICON, output.Transaction.GetName(), link)
88+
message = fmt.Sprintf("%s %s (%s)\n", FAILED_TEST_ICON, output.Transaction.GetName(), output.RunWebURL)
9089
}
9190

9291
// the transaction name + all steps
@@ -130,5 +129,5 @@ func (f transactionRun) getColoredText(passed bool, text string) string {
130129
}
131130

132131
func (f transactionRun) getRunLink(transactionID, runID string) string {
133-
return fmt.Sprintf("%s://%s/transaction/%s/run/%s", f.baseURL, transactionID, runID)
132+
return fmt.Sprintf("%s/transaction/%s/run/%s", f.baseURL, transactionID, runID)
134133
}

0 commit comments

Comments
 (0)