Add route tests for /api/user/settings/discord-test

Open Beginner friendly
#3,746 4 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@sam-zc is already working on this.

Since Nov 27, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
nextjs, typescript
Domain
api, testing-qa

Research direction

The handler is in src/app/api/user/settings/discord-test/route.ts, a 29-line POST route. Read test/goals-crud.test.ts and test/diff-trend-route.test.ts to see how route handlers are imported, called with a NextRequest, and mocked with vi.mock. Create test/api-user-settings-discord-test-route.test.ts covering the 401 without session, the 400 for an invalid body, and the happy-path status and response shape, then confirm pnpm test passes.

Written by the indexing model from the issue text.

Description

good first issue level 1 level:beginner status:assigned type:testing
Summary

src/app/api/user/settings/discord-test/route.ts (29 lines, handles POST) has no tests.

What to test
  • returns 401 when there is no session
  • returns 400 for a malformed or invalid body
  • the happy path: correct status and response shape
How

Import the handler directly and call it with a NextRequest, mocking the session, Supabase and GitHub modules with vi.mock. test/goals-crud.test.ts and test/diff-trend-route.test.ts are good examples to copy from. No real network or database calls.

Acceptance criteria
  • New file test/api-user-settings-discord-test-route.test.ts
  • Every case above is covered and pnpm test passes
Dominant language
TypeScript
Stars
246
Forks
436
Avg merge
9h 33m
Merged PRs (30d)
213

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Priyanshu-byte-coder/devtrack

All issues in Priyanshu-byte-coder/devtrack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.