Repository navigation
fix(tests): un-quarantine billing route suites - #1655
Open
Mossad-esc wants to merge 1 commit into
Open
Mossad-esc wants to merge 1 commit into
Mossad-esc wants to merge 1 commit into
Conversation
Switch billing route tests from bare x-user-id to Bearer JWTs, update error/envelope assertions, isolate idempotency mock in bulk deduct tests, add 429 response example for /api/billing/deduct in docs/openapi.json, and fix paid-invoice aggregation in portal summary. Closes CalloraOrg#1562
|
@Mossad-esc Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Repairs and un-quarantines the six
/api/billing/*route suites (billing.test.ts,billing.ratelimit.test.ts,billing.openapi.test.ts,billing/deduct/bulk.test.ts,billing/disputes.test.ts, andbilling/portal.test.ts) and removes them fromjest.quarantine.json.Root Causes & Changes
Production Bug Fix
src/routes/billing/portal.ts: Removedtake: 1from thepaidInvoicesquery inGET /api/billing/portal/summarysototalPaidaggregates all paid invoices for the user rather than only the most recent one (while keepingorderBysolastPaymentDatestill reads the latest paid invoice).OpenAPI Spec
docs/openapi.json: Added the missing429response definition (withRetry-Afterheader andrateLimitedexample) toPOST /api/billing/deduct. Verified withnpm run validate:openapi.Test & Quarantine Updates
src/routes/billing/portal.test.ts,src/routes/billing/disputes.test.ts,src/routes/billing.test.ts,src/routes/billing.ratelimit.test.ts: Switched authentication from barex-user-idheaders to Bearer JWTs (signTestTokenandTEST_JWT_SECRETfromtests/helpers/jwt.ts).src/routes/billing.ratelimit.test.ts: Updated 429 assertion fromres.body.codetores.body.error.code.src/routes/billing.test.ts: Updated pagination assertions for thesuccessEnvelopepayload (res.body.data.data/res.body.data.meta), used a numeric BigInt-compatible cursor ID, and stabilizedDate/x-request-idfor the ETag 304 test.src/routes/billing/deduct/bulk.test.ts: UpdatedmockPool.queryto return alease_tokenrow onINSERT INTO idempotency_storesoidempotencyMiddlewaredoes not return409 IDEMPOTENCY_IN_PROGRESS.jest.quarantine.json: Removed the 6 suites (103/103 tests passing undernpm test -- --runInBand).Closes #1562