fix mobile task rules and feature availability

This commit is contained in:
richjohnrambo
2026-10-18 20:53:33 +08:00
parent b79b781f15
commit 5a0fe67027
11 changed files with 144 additions and 130 deletions
+9 -2
View File
@@ -118,11 +118,18 @@ func TestQuoteCalculatesRateFeeAndLimits(t *testing.T) {
}
}
func TestQuoteFailsClosed(t *testing.T) {
func TestQuoteDefaultsToEnabledWithoutWithdrawalSwitch(t *testing.T) {
service := &Service{repository: &fakeRepository{config: json.RawMessage(`{}`)}, ready: true, now: time.Now}
if err := service.ensureWithdrawalEnabled(context.Background(), 0); err != nil {
t.Fatalf("missing switch should default to enabled, got %v", err)
}
}
func TestQuoteHonorsExplicitDisabledWithdrawalSwitch(t *testing.T) {
service := &Service{repository: &fakeRepository{config: json.RawMessage(`{"features":{"withdrawal_enabled":false}}`)}, ready: true, now: time.Now}
_, err := service.Quote(context.Background(), 0, 1, QuoteInput{PaymentAccountID: 1, Amount: 100, Currency: "CNY"})
if !errors.Is(err, store.ErrWithdrawalDisabled) {
t.Fatalf("expected disabled error, got %v", err)
t.Fatalf("expected explicitly disabled withdrawal, got %v", err)
}
}