package order import ( "testing" "github.com/perfect-panel/server/internal/types" ) func TestGetDiscount_Coefficient(t *testing.T) { discounts := []types.SubscribeDiscount{{Quantity: 7, Discount: 0.95}} got := getDiscount(discounts, 7) if got != 0.95 { t.Fatalf("expected 0.95, got %v", got) } } func TestGetDiscount_Percentage(t *testing.T) { discounts := []types.SubscribeDiscount{{Quantity: 7, Discount: 95}} got := getDiscount(discounts, 7) if got != 0.95 { t.Fatalf("expected 0.95 from 95%%, got %v", got) } } func TestGetDiscount_InvalidOver100(t *testing.T) { discounts := []types.SubscribeDiscount{{Quantity: 7, Discount: 120}} got := getDiscount(discounts, 7) if got != 1.0 { t.Fatalf("expected 1.0 when invalid >100, got %v", got) } }