package formula

import "testing"

func TestCoerceStringFromArray(t *testing.T) {
	got := coerceString([]any{"開場", "故事", "收尾"})
	want := "開場 → 故事 → 收尾"
	if got != want {
		t.Fatalf("coerceString() = %q, want %q", got, want)
	}
}

func TestParsePastedAnalysisFlexibleStructure(t *testing.T) {
	raw := `{"summary":"測試","formula":"步驟","structure":["Hook","轉折","觀點"],"wins":["節奏好"]}`
	got, err := ParsePastedAnalysis(raw)
	if err != nil {
		t.Fatalf("ParsePastedAnalysis() err = %v", err)
	}
	if got.Structure != "Hook → 轉折 → 觀點" {
		t.Fatalf("Structure = %q", got.Structure)
	}
}
