fix: unblock first growth report generation
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package growth
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -194,6 +196,19 @@ func TestBuildDeterministicReportLimitsAndOrdersOpportunities(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildDeterministicReportSerializesEmptyCollectionsAsArrays(t *testing.T) {
|
||||
report := BuildDeterministicReport(ReportInput{ForecastStart: time.Date(2026, 7, 1, 0, 0, 0, 0, time.UTC), HorizonDays: 90})
|
||||
encoded, err := json.Marshal(report)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, field := range []string{`"historicalWins":[]`, `"opportunities":[]`, `"risks":[]`, `"fallbackBriefs":[]`} {
|
||||
if !bytes.Contains(encoded, []byte(field)) {
|
||||
t.Fatalf("report must encode %s as an array: %s", field, encoded)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFingerprintTreatsEquivalentForecastDatesEqually(t *testing.T) {
|
||||
tehran, err := time.LoadLocation("Asia/Tehran")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user