Commit 718bfd7
test(razorpaybilling): drive coverage 8.5% -> 100%
Every Portal method (SubscriptionID, CancelAtCycleEnd, CancelImmediately,
ListSubscriptionInvoices, PaymentUpdateURL, ChangePlan,
FetchSubscriptionDetails) plus the toInt64 / pickInvoiceTimestamp
helpers now exercise their happy path, every error branch (4xx/5xx
upstream, no-config, DB error, sql.ErrNoRows, malformed/missing fields),
and every callWithBreaker arm — including the open-state rejection
and the WithOnOpen callback on the singleton breaker.
The Razorpay REST surface is mocked via httptest.Server; no live API
calls. A one-line test seam in portal.go (newClientForPortal) lets
tests retarget the SDK's BaseURL at the mock; production callers go
through the original NewTimeoutClient unchanged.
Coverage: 8.5% -> 100.0% of statements (go test -cover).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3308465 commit 718bfd7
2 files changed
Lines changed: 1278 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
139 | 146 | | |
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
146 | | - | |
| 153 | + | |
147 | 154 | | |
148 | 155 | | |
149 | 156 | | |
| |||
0 commit comments