Repository navigation
test: add route-level integration tests for vault HTTP endpoints - #1662
Phoniexeagle wants to merge 2 commits into
Conversation
|
@Phoniexeagle 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! 🚀 |
0e22d9a to
e8ffdd3
Compare
pr-malware-guard: please take a look (hard rule)Thanks for the contribution! The automated check found changes that match patterns used by known malware campaigns:
This is not an accusation. Those campaigns spread through infected developer machines and cloned repos, so a contributor can be affected without knowing it. What to do: please remove those changes and push again. The check re-runs automatically on every push. Worth checking on your own machine:
A maintainer will review once it is clean. Also needs a security review (soft rules)
|
|
Warning Possible malicious code: please review before merging. An automated security scan flagged files in this pull request that appear to contain malicious code. Code like this can run automatically when a project is opened in an editor or its dependencies are installed, so it could compromise the machine of anyone who checks out this branch. Automated scans can be wrong, so this may be a false positive. Maintainers: please review the flagged files carefully before merging, on GitHub in your browser rather than by checking out the branch. The malicious part is often hidden far off to the right of an ordinary-looking line, so scroll sideways through each file. @Phoniexeagle: this pull request adds or changes these files, possibly without your knowledge. Malware like this spreads by adding itself to repositories on machines it has infected, so your machine and / or GitHub account may be compromised. Please review your machine for a possible malware infection, and rotate your GitHub credentials / SSH keys as needed. Flagged files at commit Only merge once you're confident these files are safe. ℹ️ Posted automatically by Drips Wave. Questions? Contact support@drips.network. |
|
Hi @Phoniexeagle, our security check found code in this PR that matches known malware patterns: eslint.config.js:154 (a ~34 KB line of heavily obfuscated JavaScript that touches |
|
@greatest0fallt1me — this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed 6674a5e). |
Overview
This PR adds a route-level supertest suite for the vault HTTP routes. It mounts the real
registerVaultRouteswiring with the realrequireAuthmiddleware, anInMemoryVaultRepository, and an injectedVaultStateReaderstub, covering authentication, network query validation, snapshot freshness/refresh/failure branches, and deposit preparation validation.Related Issue
Changes
src/routes/vaultRoutes.test.tsexpress.json(),requestIdMiddleware,registerVaultRoutes(app, new InMemoryVaultRepository(), reader)anderrorHandler;JWT_SECRETset to the test secret.POST /api/vault/deposit/prepare,GET /api/vault/balanceandGET /api/vault/onchainreturn 401 without a token and with an expired token.GET /api/vault/balance:networkquery value.VAULT_NOT_FOUNDwhen the user has no vault.stale: false), asserting the reader is called.stale: true.mainnetvs default) resolves the correct vault created viarepository.create(userId, contractId, network).POST /api/vault/deposit/prepare: 400MISSING_AMOUNTwhenamount_usdcis absent; vault-not-found behaviour when the user has no vault.jest.fn()stub; no Stellar network access.Verification Results
readVaultcall expectationsnpm testwithout network accesslastSyncedAtnull, snapshot at max-age boundary, non-stringnetworkNotes
src/routes/vaultRoutes.test.tsis added; no production code, build output, or workflow changes.Closes #1600