Repository navigation
test: add unit tests for Stellar config and route body limits - #748
Merged
DeFiVC merged 2 commits intoOct 21, 2026
Merged
Conversation
|
@DeJune06 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
Adds real unit test coverage for the Stellar SDK configuration helpers and the per-route body size limits config. A third issue in this batch (#597, SSRF guard tests) was checked against
mainfirst and found already fully covered by the existingtests/unit/utils/ssrf-guard.test.ts, so no redundant tests were added for it.closes #604
closes #605
closes #597
closes #610
Changes
tests/unit/config/stellar.test.tscoveringgetNetworkPassphrase()(testnet/mainnet/default),getHorizonServer()andgetSorobanServer()(correct URL wiring, new instance per call), andgetPlatformKeypair()(loads fromSTELLAR_PLATFORM_SECRET, singleton caching, correct public key derivation). Follows the existingvi.resetModules()+ fresh-env-import pattern already used intests/unit/config/cors-origins.test.ts.tests/unit/config/route-body-limits.test.tsasserting the exact byte values forprofileUpdate,courseImport,quizAuthoring,webhookCreate, their relative ordering, and that each limit is wired into the route module that's supposed to use it (user.routes.ts,webhook.routes.ts,admin-course.routes.ts), by asserting the source references the rightROUTE_BODY_LIMITSkey.Not included
main. The existingtests/unit/utils/ssrf-guard.test.tscovers private IPv4 ranges (10.x, 172.16.x, 192.168.x), loopback, the cloud metadata endpoint, the unspecified address, localhost and subdomains, IPv6 loopback/link-local, valid public URLs, and malformed URLs — matching every item in the issue's acceptance criteria. "DNS rebinding protection" from the issue's scope isn't implemented insrc/utils/ssrf-guard.tsby design (the module's own doc comment explains this is a deliberate limitation, since it would require a dispatch-time check rather than a URL-validation-time one), so there's no such behavior to test. No changes made for this issue.Test plan
npx vitest run tests/unit/config/stellar.test.ts tests/unit/config/route-body-limits.test.ts— 21/21 passing.npx eslint tests/unit/config/stellar.test.ts tests/unit/config/route-body-limits.test.ts— clean..env.test-dependent config tests weren't broken by diffing failure counts with and without these two files present; the two new files introduce zero new failures.tsc --noEmit -p tsconfig.test.jsonreports a pre-existingimport.metaCommonJS error on myroute-body-limits.test.ts, matching the identical pre-existing pattern already present intests/unit/config/test-mode-required-vars.test.tsonmain— this is a repo-wide tsconfig/vitest-vs-tsc mismatch, not something introduced here, andvitest run(the actual test runner) has no issue with it.