test(handlers): raise billing-handler coverage#150
Merged
Conversation
Add targeted tests for the Razorpay-webhook event matrix (charged / activated / cancelled / halted / completed / paused / resumed / pending / charged_failed / deauthenticated / updated / refund), replay dedup, the ±5-minute timestamp guard, retryable-vs-non-retryable team-resolve paths, dunning dedup, payment-grace recovery, the checkout reuse/create/promo paths, ChangePlan/ListInvoices/UpdatePayment branches, and the brevo / promotion / usage helpers. Test-only change. Coverage (isolated serial run): brevo_webhook.go 96.6%, billing_promotion.go 98.7%, billing_usage.go 100%, billing.go 92.8% (the remaining billing.go lines are best-effort secondary-write-error logs that need mid-handler fault injection, and Razorpay-API success paths gated behind the razorpay-go client's hardcoded base URL — neither reachable without editing non-target source). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
billing.go,brevo_webhook.go,billing_promotion.go,billing_usage.go).Coverage (isolated serial run, all tests PASS)
brevo_webhook.gobilling_promotion.gobilling_usage.gobilling.gobilling.gofalls short of 95%: the remaining lines are best-effort secondary-DB-write-error logs (need mid-handler fault injection) and Razorpay-API success response-shaping paths gated behind the razorpay-go client's hardcodedapi.razorpay.combase URL — neither reachable without editing non-target source.Test plan
go test ./internal/handlers -count=1 -p 1passes on an isolated Postgres+Redis+Mongo DB (exit 0).go vet ./internal/handlersclean.🤖 Generated with Claude Code