Files
Bookra/apps/backend/internal/config/config_test.go
T
Tomas DvorakandDevin f2f7439050 refactor(db): replace sqlc with handwritten pgx repos
- Finish Paddle-to-Stripe billing migration; drop paddle/stripe libs
- Renumber migrations; add 00012 memberships+manage_token,
  00013 location_type_capacity
- Add tests: admin, auth, bookings customer service
- Remove graphify-out artifacts and stale env files

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-17 20:21:34 +02:00

39 lines
1.0 KiB
Go

package config
import "testing"
func TestStripeCheckoutConfigured(t *testing.T) {
cfg := Config{
StripeAPIKey: "sk_test_123",
StripeWebhookKey: "whsec_test_123",
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")
}
}