Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# Project binary
buzz
buzz_test

# Test binary, built with `go test -c`
*.test
Expand Down
11 changes: 5 additions & 6 deletions review.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,6 @@ func formatGoalDetails(goal *Goal, config *Config) string {
var details string

details += fmt.Sprintf("Title: %s\n", goal.Title)

// Display fine print if it exists
if goal.Fineprint != "" {
details += fmt.Sprintf("Fine print: %s\n", goal.Fineprint)
}

details += fmt.Sprintf("Limsum: %s\n", goal.Limsum)

// Display deadline (formatted timestamp)
Expand Down Expand Up @@ -260,5 +254,10 @@ func formatGoalDetails(goal *Goal, config *Config) string {
goalURL := fmt.Sprintf("%s/%s/%s", baseURL, url.PathEscape(config.Username), url.PathEscape(goal.Slug))
details += fmt.Sprintf("URL: %s\n", goalURL)

// Display fine print if it exists (at the end)
if goal.Fineprint != "" {
details += fmt.Sprintf("Fine print: %s\n", goal.Fineprint)
}

return details
}
38 changes: 38 additions & 0 deletions review_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,41 @@ func TestReviewModelViewWithURL(t *testing.T) {
t.Errorf("Expected view to contain '%s', but got:\n%s", expectedURL, view)
}
}

// TestFineprintOrderInOutput verifies that fineprint appears after URL in the output
func TestFineprintOrderInOutput(t *testing.T) {
goal := Goal{
Slug: "testgoal",
Title: "Test Goal",
Fineprint: "This is the fine print",
Limsum: "+1 in 2 days",
Losedate: 1234567890,
Deadline: 0,
Pledge: 10.0,
Autodata: "manual",
}

config := &Config{
Username: "testuser",
AuthToken: "testtoken",
}

output := formatGoalDetails(&goal, config)

// Find positions of URL and Fine print in the output
urlIndex := strings.Index(output, "URL:")
fineprintIndex := strings.Index(output, "Fine print:")

if urlIndex == -1 {
t.Error("URL not found in output")
}

if fineprintIndex == -1 {
t.Error("Fine print not found in output")
}

// Verify that Fine print comes after URL
if fineprintIndex <= urlIndex {
t.Errorf("Expected Fine print to come after URL, but Fine print is at position %d and URL is at position %d", fineprintIndex, urlIndex)
}
}