Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package billing
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsPublicProductPlan(t *testing.T) {
|
||||
public := []string{"Free", "Starter", "Growth", "Business", "Enterprise", " free ", "GROWTH"}
|
||||
for _, name := range public {
|
||||
if !IsPublicProductPlan(name) {
|
||||
t.Fatalf("expected public: %q", name)
|
||||
}
|
||||
}
|
||||
hidden := []string{"A1", "Merkur trial", "Merkur", "Meur", "Basic", "Professional", "Mini", ""}
|
||||
for _, name := range hidden {
|
||||
if IsPublicProductPlan(name) {
|
||||
t.Fatalf("expected hidden from public pricing: %q", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterPublicPlans(t *testing.T) {
|
||||
all := []Plan{
|
||||
{Name: "Basic"},
|
||||
{Name: "A1", IsCustom: true},
|
||||
{Name: "Merkur trial", IsCustom: true},
|
||||
{Name: "Free"},
|
||||
{Name: "Starter"},
|
||||
{Name: "Growth"},
|
||||
{Name: "Business"},
|
||||
{Name: "Enterprise", IsCustom: true},
|
||||
{Name: "Professional"},
|
||||
}
|
||||
out := make([]Plan, 0, 5)
|
||||
for _, p := range all {
|
||||
if IsPublicProductPlan(p.Name) {
|
||||
out = append(out, p)
|
||||
}
|
||||
}
|
||||
if len(out) != 5 {
|
||||
t.Fatalf("got %d public plans, want 5: %+v", len(out), out)
|
||||
}
|
||||
for _, p := range out {
|
||||
key := strings.ToLower(p.Name)
|
||||
switch key {
|
||||
case "free", "starter", "growth", "business", "enterprise":
|
||||
default:
|
||||
t.Fatalf("unexpected public plan %q", p.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user