Files
Bookra/apps/backend/internal/config/config_test.go
T
Tomáš DvořákandDevin 1cd14046de chore(tooling): oxlint + oxfmt frontend, lefthook gate, govulncheck (#21)
- apps/frontend: oxlint 1.85 (typescript/unicorn/oxc — no react rules,
  SolidJS), oxfmt scripts; lint script now oxlint && tsc --noEmit
- backend: gofmt; bump x/text 0.39.0, quic-go 0.59.1, pgx 5.9.2
  (govulncheck 0 reachable vulns, was 3)
- ci: go vet + govulncheck in Go job (frontend job already gates via
  lint:frontend)
- lefthook pre-push: frontend lint + gofmt + vet/test + gitleaks

Authored By: TDvorak <[email protected]>

Generated with [Devin](https://devin.ai)

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-26 16:41:35 +02:00

39 lines
1.1 KiB
Go

package config
import "testing"
func TestStripeCheckoutConfigured(t *testing.T) {
cfg := Config{
StripeAPIKey: "sk_test_123", // gitleaks:allow — test fixture, not a real key
StripeWebhookKey: "whsec_test_123", // gitleaks:allow — test fixture, not a real key
StripePriceMatrix: map[string]map[string]string{
"starter": {"czk": "price_starter_czk", "usd": "price_starter_usd"},
"pro": {"czk": "price_pro_czk", "usd": "price_pro_usd"},
"business": {"czk": "price_business_czk", "usd": "price_business_usd"},
},
}
if !cfg.StripeCheckoutConfigured("pro") {
t.Fatal("expected pro checkout configured")
}
}
func TestStripeCheckoutConfiguredRequiresWebhook(t *testing.T) {
cfg := Config{
StripeAPIKey: "sk_test_123",
StripePriceMatrix: map[string]map[string]string{
"pro": {"czk": "price_pro_czk", "usd": "price_pro_usd"},
},
}
if cfg.StripeCheckoutConfigured("pro") {
t.Fatal("expected checkout disabled without webhook key")
}
}
func TestBillingProviderIsStripe(t *testing.T) {
if (Config{}).BillingProvider() != "stripe" {
t.Fatal("expected stripe billing provider")
}
}