Retire dormant prompt compatibility APIs
This commit is contained in:
@@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestValidateDailyNormalizesJSON(t *testing.T) {
|
||||
value, normalized, err := ValidateDaily([]byte(`{
|
||||
func TestValidateDailyNormalizesFields(t *testing.T) {
|
||||
value, err := ValidateDaily([]byte(`{
|
||||
"summary": " Showers are possible during the selected day. ",
|
||||
"forecast_discussion": [
|
||||
" A front will keep rain chances in the forecast. ",
|
||||
@@ -27,14 +27,10 @@ func TestValidateDailyNormalizesJSON(t *testing.T) {
|
||||
if value.PrecipitationTiming != "Rain is most likely during the afternoon." {
|
||||
t.Fatalf("PrecipitationTiming = %q, want trimmed precipitation timing", value.PrecipitationTiming)
|
||||
}
|
||||
want := `{"summary":"Showers are possible during the selected day.","forecast_discussion":["A front will keep rain chances in the forecast.","Temperatures stay seasonable by afternoon."],"precipitation_timing":"Rain is most likely during the afternoon."}`
|
||||
if string(normalized) != want {
|
||||
t.Fatalf("normalized = %s, want %s", normalized, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateDailyPreservesRequiredEmptyPrecipitationTiming(t *testing.T) {
|
||||
_, normalized, err := ValidateDaily([]byte(`{
|
||||
value, err := ValidateDaily([]byte(`{
|
||||
"summary": "Showers are possible during the selected day.",
|
||||
"forecast_discussion": ["A front will keep rain chances in the forecast."],
|
||||
"precipitation_timing": " "
|
||||
@@ -42,9 +38,8 @@ func TestValidateDailyPreservesRequiredEmptyPrecipitationTiming(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("ValidateDaily() error = %v", err)
|
||||
}
|
||||
want := `{"summary":"Showers are possible during the selected day.","forecast_discussion":["A front will keep rain chances in the forecast."],"precipitation_timing":""}`
|
||||
if string(normalized) != want {
|
||||
t.Fatalf("normalized = %s, want %s", normalized, want)
|
||||
if value.PrecipitationTiming != "" {
|
||||
t.Fatalf("PrecipitationTiming = %q, want required empty value", value.PrecipitationTiming)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +92,7 @@ func TestValidateDailyRejectsInvalidInput(t *testing.T) {
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
_, _, err := ValidateDaily([]byte(test.in))
|
||||
_, err := ValidateDaily([]byte(test.in))
|
||||
if err == nil {
|
||||
t.Fatal("ValidateDaily() error = nil, want error")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user