38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package learnernotifications
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"Yimaru-Backend/internal/domain"
|
|
)
|
|
|
|
func TestSubscriptionPackageLabel(t *testing.T) {
|
|
if got := subscriptionPackageLabel("IELTS"); got != "IELTS" {
|
|
t.Fatalf("got %q", got)
|
|
}
|
|
if got := subscriptionPackageLabel("learn_english"); got != "Learn English" {
|
|
t.Fatalf("got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestSubscriptionExpiresLabel(t *testing.T) {
|
|
expiresAt := time.Date(2026, 12, 31, 0, 0, 0, 0, time.UTC)
|
|
label, lifetime := subscriptionExpiresLabel(string(domain.SubscriptionCategoryIELTS), expiresAt)
|
|
if lifetime || label != "Dec 31, 2026" {
|
|
t.Fatalf("label=%q lifetime=%v", label, lifetime)
|
|
}
|
|
|
|
label, lifetime = subscriptionExpiresLabel(string(domain.SubscriptionCategoryDuolingo), expiresAt)
|
|
if !lifetime || label != "" {
|
|
t.Fatalf("label=%q lifetime=%v", label, lifetime)
|
|
}
|
|
}
|
|
|
|
func TestSubscriptionActivatedMessage(t *testing.T) {
|
|
msg := subscriptionActivatedMessage(string(domain.SubscriptionCategoryIELTS), "Premium")
|
|
if msg == "" || msg == "Premium" {
|
|
t.Fatalf("unexpected message: %q", msg)
|
|
}
|
|
}
|