#58 Write End-to-End Integration Tests for Core API Flows FIXED#181
#58 Write End-to-End Integration Tests for Core API Flows FIXED#181felladaniel36-hash wants to merge 6 commits into
Conversation
|
Someone is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@felladaniel36-hash 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! 🚀 |
|
Fix check |
|
Could you click the Update branch button on your end, or run git pull origin main locally and push? That will make the tests pass so I can merge this!" |
|
ISSUE RESOLVED... |
|
everything is up to date |
|
Fix conflicts and Please fix the backend build test, click on the three dot at the front of it and then click on details to see more about the error. that would help you in fixing the errors |
|
It has not passed yet |
|
CHECKED... please review and ping me back... |
|
Fix backend build test error |
Findings
server.jsoriginally defined all public routes at the root level (/register,/lookup,/users,/federation). However, the integration requirements specifically demanded interacting with/api/v1/register.UNIQUEprimary key constraints on theusernamecolumn to identify and reject duplicate user registration attempts. Existing test suites in the repository were purely unit tests that mockedsqlite3andgeneric-pool, meaning there was no prior test validating how the Express routes, real SQLite database engine, and global error-handling middleware interact during constraint violations.lint-staged. When new test files are added without explicit ESLint environment directives, ESLint rejects standard Jest global identifiers (jest,describe,test,expect,beforeAll,afterAll) as undefined variables (no-undef), causing Husky to abort commits and throw theGit: [STARTED] Backing up original state...rollback alert in VS Code.Fix Features
/api/v1/*Route Aliasing:server.jsto accept path arrays (e.g.,app.post(['/register', '/api/v1/register'], ...)). This satisfies the new integration acceptance criteria while maintaining 100% backward compatibility for legacy API callers and existing unit test suites.stellar-payment-platform/integration.test.js) powered bysupertestthat validates the full user journey:POST /api/v1/registerwith a valid Ed25519 Stellar public key and verifies a201 Createdstatus return.GET /api/v1/lookup?address=...), partial search (GET /api/v1/lookup?search=...), and federation resolution (GET /api/v1/federation?q=...), asserting expected200 OKJSON responses.UNIQUEconstraint triggers correctly and yields the expected409 Conflict(Username already registered) JSON payload.beforeAllandafterAlltest hooks to automatically executeDELETE FROM username_registryto guarantee mock database rows are cleared before and after test executions.mock-integration-registrations.db) viaprocess.env.DB_PATHto ensure complete isolation from other environments, with automated unlinking/teardown upon test completion./* eslint-env jest */at the top ofintegration.test.jsand removed unused block variables to fully satisfy the linting engine, ensuring clean, unblocked Git commits and pull request creation.CLOSE #58