test(connect): add regression testing for oauth callback flow#411
Conversation
|
@VIDYANKSHINI Please add tests terminal proof in PR description. |
RUN v2.1.9 C:/Users/VIDYANKSHINI/Desktop/project/DEV/DevCard/apps/backend ✓ src/tests/connect.test.ts (7 tests) 187ms Test Files 1 passed (1) |
|
Hi @Harxhit, I have added the terminal proof of the successful test runs to the PR description as requested. All 7 test cases for the OAuth connect callback flow are passing perfectly. Could you please review and merge this when you have a moment? Thank you! |
Harxhit
left a comment
There was a problem hiding this comment.
LGTM. Tests are passing. Approving
|
Congratulations @VIDYANKSHINI on getting PR #411 merged! |
Summary
This PR introduces comprehensive regression testing for the OAuth connect callback flow to fulfill the Acceptance Criteria for Issue #380. (Note: The core route logic to remove
app.authenticateand use the Redis nonce flow was already merged in upstreammainduring a previous sync, so this PR exclusively adds the missing test coverage to guarantee its security and functionality).Closes #380
Type of Change
What Changed
apps/backend/src/__tests__/connect.test.ts:vitest,mockRedis, andmockPrisma.codeorstate).redis.delis strictly called upon nonce verification.How to Test
apps/backenddirectory.pnpm exec vitest run src/__tests__/connect.test.ts.Checklist
pnpm -r run lintpasses).pnpm -r run typecheck).pnpm -r run test).console.logor debug statements left in the code.Screenshots / Recordings
N/A (Tests only)
Additional Context
The mocked test environment utilizes Fastify
app.injectrequests to simulate browser-level GET redirects. It correctly verifies that the Redis layer mitigates CSRF while keeping the endpoints gracefully redirecting to/settingswith specific error query parameters.