Skip to content

Add route-level tests for stars and project recommendations - #98

Merged
sarthakagrawal927 merged 1 commit into
mainfrom
test/stars-recommendations-routes
Aug 16, 2026
Merged

Add route-level tests for stars and project recommendations#98
sarthakagrawal927 merged 1 commit into
mainfrom
test/stars-recommendations-routes

Conversation

@sarthakagrawal927

Copy link
Copy Markdown
Member

Why

Search and similar-repo helpers already have unit tests. /api/stars and /api/projects/:slug/recommendations still lacked route-level coverage for auth, empty RAG, and SQL argument behavior.

What

  • Add src/__tests__/stars-api.test.ts in the same hoisted-mock style as similar-repos-api.test.ts.
    • 401 when there is no githubId (guest and signed-in-without-id)
    • signed-in success binds the user and filters as SQL parameters
    • empty knowledgebase RAG still uses the lexical FTS path
  • Add src/__tests__/project-recommendations-api.test.ts for the remaining route-boundary cases that projects-api.test.ts does not cover:
    • refuse unauthenticated requests
    • empty peer/tool payload
    • peer-limit clamp (200 → 50, 0 → 24)
  • Ranking helpers stay in the existing lib tests. Production ranking and SQL semantics are unchanged.

Closes #97

Add Vitest route tests for /api/stars and /api/projects/:slug/recommendations
auth, empty RAG/empty peers, parameterized SQL, and peer-limit clamping.

Closes #97
@sarthakagrawal927
sarthakagrawal927 merged commit c128d71 into main Aug 16, 2026
2 checks passed
@sarthakagrawal927
sarthakagrawal927 deleted the test/stars-recommendations-routes branch August 16, 2026 17:59
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.

Add route-level tests for stars and project recommendations

1 participant