mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 23:51:17 +00:00
- 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>
39 lines
1.0 KiB
Go
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")
|
|
}
|
|
}
|