Skip to content

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

Description

@Dev-Mayuresh

Bug Description

The CI test suite in GitHub Actions has been failing during automated test runs due to missing endpoint documentation in docs/api.md and outdated test expectations in backend/tests/uploadPhoto.test.js.

Steps to Reproduce

  1. Run npx vitest run in the project root.
  2. Observe test failures in backend/tests/docs.test.js and backend/tests/uploadPhoto.test.js.

Root Cause

  1. backend/tests/docs.test.js asserts that all production API endpoints and upload validation rules are documented in docs/api.md. The /api/upload and /api/users/upload-photo endpoints, along with magic-byte validation specs, were missing from docs/api.md.
  2. backend/tests/uploadPhoto.test.js contained obsolete test assertions expecting a 5MB upload size limit (reduced to 2MB in PR Severe Security: Remote Code Execution via Unrestricted File Upload in Profile Assets #1850) and an outdated fileUrl regex format.

Impact

GitHub Actions CI test runs fail on pull requests and main branch commits, blocking valid PR integrations and deployment pipelines.

Proposed Fix

  1. Update docs/api.md to document /api/upload, /api/users/upload-photo, and their associated magic byte and preset validation rules.
  2. Update backend/tests/uploadPhoto.test.js assertions to reflect the 2MB photo size limit and correct user-scoped fileUrl pathing.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions