🧪[test] GET /api/auth/me - Karate tests#414
Conversation
|
@robertocarlous Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Karate coverage for ChangesGET /api/auth/me role coverage
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@tests/karate/features/auth/roles.feature`:
- Around line 32-37: The role assertions in the auth/roles feature are too loose
and should verify the exact role set returned by `/api/auth/me` and stored in
`user_roles`. Update the scenarios that use `response.user.roles contains
'host'` and the DB checks around `db.query(...)` so they assert the full
expected single-role list rather than only checking membership or the first row.
Use the affected scenario blocks in the roles.feature file to ensure `roles`
matches exactly one of `host`, `guest`, or `admin`, with no extra roles present.
🪄 Autofix (Beta)
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
Run ID: 6e691f84-4153-4d57-abfa-1295e034c79a
📒 Files selected for processing (2)
tests/karate/features/auth/roles.featuretests/karate/fixtures/seed-test-users.sql
sotoJ24
left a comment
There was a problem hiding this comment.
Good job dear @robertocarlous
Closes #408
Description:
Adds an authenticated endpoint that reads public.user_roles and returns the user’s roles plus a dashboard redirect path.
Summary
Adds webhook/src/routes/auth/me.handler.js to query user_roles joined with roles
Registers GET /api/auth/me in the auth router (protected by existing Firebase auth middleware)
Returns { user: { id, email, roles }, redirect } with mapping:
host / admin → /dashboard/escrow-dashboard
guest / no role → /dashboard/guest
Summary by CodeRabbit
GET /api/auth/merole-based dashboard redirects.