Add profile platform link route tests - #238
Conversation
|
If your work is completed please mark it for review. |
|
I re-audited this draft. The branch is currently conflicting with |
f88b18e to
d9233be
Compare
|
@dangzitou is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Rebased onto the current Validation: |
CI — All Checks PassedBackend — PASS
Mobile — SKIP
Web — SKIP
Last updated: |
|
Current remote checks after the rebase: |
|
The rebased branch passes backend CI and the targeted profile tests (12/12) plus ESLint; the remaining Vercel failure is external authorization. I have marked the PR ready for maintainer review. |
There was a problem hiding this comment.
🟢 Approval recommended
The change set is low-risk and limited to test coverage additions, with only minor test-assertion hardening suggested.
Pull request overview
Adds backend route-level Vitest coverage for profile platform link endpoints to improve confidence in validation, not-found handling, and successful create/delete behaviors (with Prisma mocked).
Changes:
- Expanded the Prisma mock used by profile route tests to include
platformLinkmodel methods. - Added tests for
POST /api/profiles/me/linkscovering invalid-body validation and successful creation. - Added tests for
PUT /api/profiles/me/links/:idnot-found behavior andDELETE /api/profiles/me/links/:idsuccessful deletion (204, empty body).
File summaries
| File | Description |
|---|---|
| apps/backend/src/tests/profiles.test.ts | Extends Prisma mocks and adds focused tests for platform link create/update/delete routes. |
Review details
Suppressed comments (1)
apps/backend/src/tests/profiles.test.ts:186
- For the invalid POST /me/links body test, also assert that
platformLink.aggregateis not called. Validation should short-circuit before any DB reads, and this extra assertion will catch regressions where the handler does work before schema validation.
expect(res.statusCode).toBe(400);
expect(res.json().error).toBe('Validation failed');
expect(mockPlatformLinkCreate).not.toHaveBeenCalled();
});
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Follow-up pushed in 2e6af63: rejected profile updates now explicitly assert that no database write occurs. The focused suite passes 12/12, ESLint is clean, and repository backend CI is green. The remaining Vercel failure requires authorization from the project Vercel team. @Harxhit, ready for review. |
There was a problem hiding this comment.
🟢 Approval recommended
The changes are isolated to test code and the added assertions align with the current route/service behavior for platform-link create/update/delete flows.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
Allow me some time please. |
|
Congratulations @dangzitou on getting PR #238 merged! Thank you for your contribution to the project. To receive the appropriate GSSoC labels and recognition, please mention @Harxhit in the #get-labels channel on our Discord server and share your merged PR link. |
Summary
The profiles API currently lacks focused backend coverage for creating, updating, and deleting platform links, making validation and typed response behavior harder to verify. This change adds Vitest coverage for POST /api/profiles/me/links validation and success paths, PUT /api/profiles/me/links/:id not-found handling, and DELETE /api/profiles/me/links/:id successful deletion using mocked Prisma platformLink methods.
Changes
Validation
Risks