Skip to content

test file : cover unsupported follow platform error#93

Open
ojasdhargave-iiitv wants to merge 1 commit into
Dev-Card:mainfrom
ojasdhargave-iiitv:tests-for-follow-route-unsupported-platform-error
Open

test file : cover unsupported follow platform error#93
ojasdhargave-iiitv wants to merge 1 commit into
Dev-Card:mainfrom
ojasdhargave-iiitv:tests-for-follow-route-unsupported-platform-error

Conversation

@ojasdhargave-iiitv
Copy link
Copy Markdown

Summary

Added a backend Vitest test for the follow route to verify unsupported API-follow platforms return a 400 response with the expected error message.

Closes #6


Type of Change

  • Bug fix
  • New feature
  • Refactor (no functional change)
  • UI / Design change
  • Tests only
  • Documentation
  • Infrastructure / DevOps
  • Security

What Changed

  • Added apps/backend/src/__tests__/follow.test.ts.
  • Added an auth stub for the follow route test.
  • Stubbed Prisma and encryption so POST /api/follow/unknown/targetUser reaches the unsupported platform branch.

How to Test

  1. Run backend tests:
    pnpm --filter @devcard/backend test
    

Checklist

  • My code follows the project's coding style (pnpm -r run lint passes).
  • [ ✔️] TypeScript compiles without errors (pnpm -r run typecheck).
  • [ ✔️] I have added or updated tests for the changes I made.
  • All tests pass locally (pnpm -r run test).
  • I have updated documentation where necessary.
  • [✔️ ] No new console.log or debug statements left in the code.
  • Breaking changes are documented in this PR description.

Screenshot 2026-05-15 150010

##Additional Context

pnpm --filter @devcard/backend test passes locally.

pnpm -r run lint currently fails before reaching this change because eslint is not available in the workspace.

pnpm -r run test currently fails in apps/mobile because Jest cannot parse React Native ESM imports (SyntaxError: Cannot use import statement outside a module). The backend test suite for this change passes.

Copilot AI review requested due to automatic review settings May 15, 2026 09:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Vitest test for the backend follow route to assert that unsupported platforms return a 400 with the expected error message.

Changes:

  • New test file covering POST /api/follow/:platform/:targetUsername unsupported-platform path
  • Mocks decrypt and stubs Prisma + authenticate decorators on a fresh Fastify instance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

backend: add tests for follow route unsupported platform error

2 participants