Strip disallowed characters from customization title and description so subscription payments pass Chapa validation. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
781 B
Go
29 lines
781 B
Go
package chapa
|
|
|
|
import "testing"
|
|
|
|
func TestSanitizeChapaCustomization(t *testing.T) {
|
|
tests := []struct {
|
|
in string
|
|
want string
|
|
}{
|
|
{"Subscription: Premium", "Subscription Premium"},
|
|
{"New Test Monthly Premium", "New Test Monthly Premium"},
|
|
{"IELTS (Prep) / Monthly", "IELTS Prep Monthly"},
|
|
{"", "Yimaru subscription"},
|
|
}
|
|
for _, tc := range tests {
|
|
if got := sanitizeChapaCustomization(tc.in); got != tc.want {
|
|
t.Fatalf("sanitizeChapaCustomization(%q) = %q, want %q", tc.in, got, tc.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestChapaSubscriptionDescription(t *testing.T) {
|
|
got := chapaSubscriptionDescription("New Test Monthly Premium")
|
|
want := "Subscription New Test Monthly Premium"
|
|
if got != want {
|
|
t.Fatalf("chapaSubscriptionDescription() = %q, want %q", got, want)
|
|
}
|
|
}
|