Skip to content

fix(ci): update api.md and uploadPhoto tests to fix CI test failures - #1949

Open
Dev-Mayuresh wants to merge 2 commits into
durdana3105:mainfrom
Dev-Mayuresh:fix/ci-test-failures
Open

fix(ci): update api.md and uploadPhoto tests to fix CI test failures#1949
Dev-Mayuresh wants to merge 2 commits into
durdana3105:mainfrom
Dev-Mayuresh:fix/ci-test-failures

Conversation

@Dev-Mayuresh

@Dev-Mayuresh Dev-Mayuresh commented Aug 7, 2026

Copy link
Copy Markdown

Description

This PR fixes #1940 the failing CI tests on GitHub Actions.

What caused the test failures?

  1. Missing documentation (docs/api.md):
    The test file docs.test.js checks if backend routes are documented. It was failing because the /api/upload and /api/users/upload-photo endpoints were missing from docs/api.md.

  2. Outdated test rules (uploadPhoto.test.js):

    • The test was checking for an old 5MB file upload limit, but the backend limit was updated to 2MB.
    • The test was also checking for an old filename structure that didn't match the actual uploaded file path returned by the server.

Changes Made

  • Added documentation for /api/upload and /api/users/upload-photo in docs/api.md.
  • Updated uploadPhoto.test.js to match the correct 2MB limit and correct user file URL format.

Verification

Ran both CI test commands locally:

  1. Full Suite with Coverage:

    npx vitest run --coverage
    
    

Summary by CodeRabbit

  • Documentation

    • Added API documentation for photo and file upload endpoints.
    • Documented supported upload types and file validation behavior.
  • Tests

    • Updated upload tests to support flexible returned URLs.
    • Added coverage for the 2 MB oversized-file limit and corresponding error message.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

@Dev-Mayuresh is attempting to deploy a commit to the durdana3105's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates upload tests for user-scoped URLs and a 2 MB size limit. It documents both upload endpoints, accepted upload types, and magic-byte validation.

Changes

Upload validation

Layer / File(s) Summary
Upload contract tests and API documentation
backend/tests/uploadPhoto.test.js, docs/api.md
The tests check URLs containing the authenticated user ID and use a 3 MB payload to verify the 2 MB limit. The API documentation describes both upload endpoints, supported types, and magic-byte validation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

Possibly related PRs

Suggested labels: type:bug

Suggested reviewers: srejoye, mayurigade-hub

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the CI fixes and the updates to api.md and uploadPhoto tests.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/tests/uploadPhoto.test.js`:
- Line 170: Update the uploadPhoto test assertion around res.body.fileUrl to
parse the URL and verify TEST_USER_ID appears as a pathname segment immediately
beneath the profiles bucket, rather than using a broad toContain check that can
match unrelated URL content.

In `@docs/api.md`:
- Around line 133-140: Expand the POST /api/upload and POST
/api/users/upload-photo entries in the API documentation to specify required
authentication, multipart form fields, permitted folder values for the generic
upload, and each response field. Document that generic uploads return data.url,
profile-photo uploads return fileUrl, and profile photos are limited to 2 MiB.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a12f5032-d968-4e4d-ab43-5be8ab777c12

📥 Commits

Reviewing files that changed from the base of the PR and between d0a5116 and 1f7c040.

📒 Files selected for processing (2)
  • backend/tests/uploadPhoto.test.js
  • docs/api.md

Comment thread backend/tests/uploadPhoto.test.js
Comment thread docs/api.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CI test failures in docs.test.js and uploadPhoto.test.js

1 participant