Skip to content

test : added unit tests for authStore logout flow - #2082

Merged
riteshbonthalakoti merged 1 commit into
riteshbonthalakoti:gssocfrom
tmdeveloper007:#2060
Jun 7, 2026
Merged

test : added unit tests for authStore logout flow#2082
riteshbonthalakoti merged 1 commit into
riteshbonthalakoti:gssocfrom
tmdeveloper007:#2060

Conversation

@tmdeveloper007

Copy link
Copy Markdown

Closes #2060.

Summary of What Has Been Done:
Added unit tests for the authStore logout flow. Also fixed a security bug where user state was not cleared when signOut failed.

Changes Made:

  • Created Frontend/src/store/authStore.test.js with 8 test cases
  • Mocks supabase.auth.signOut and ticketStore methods
  • Tests: successful logout, signOut call, ticketStore.clearTicket, ticketStore.setState, loading state, error handling
  • Fixed authStore.js: moved state clearing from try block to finally block
  • This ensures user data is cleared even when signOut fails (network error, etc.)
  • Prevents cross-user data leakage on logout error paths

Impact it Made:

  • Critical security fix: prevents stale user data after logout failure
  • All 8 tests pass (verified with vitest run)
  • No new lint errors introduced

fix: move state clearing to finally block to prevent data leakage on error
@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

@tmdeveloper007 is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tmdeveloper007, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 24 minutes and 8 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0b831136-1f0b-44fd-aff3-7ac99f68addd

📥 Commits

Reviewing files that changed from the base of the PR and between da8faf2 and 50896cd.

📒 Files selected for processing (2)
  • Frontend/src/store/authStore.js
  • Frontend/src/store/authStore.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@riteshbonthalakoti
riteshbonthalakoti changed the base branch from main to gssoc June 7, 2026 16:01
@riteshbonthalakoti riteshbonthalakoti added gssoc GirlScript Summer of Code gssoc:approved GSSoC Approved PR level:advanced Advanced level difficulty quality:clean Clean code quality type:testing Testing suites, mock coverages, CI/CD integrations labels Jun 7, 2026
@riteshbonthalakoti

Copy link
Copy Markdown
Owner

Superb implementation, @tmdeveloper007! I've successfully resolved all conflicts in your PR and queued it for merging into gssoc.

⚠️ MANDATORY STEPS FOR LEADERBOARD CREDITS:
To ensure you receive full points, please make sure you have taken 10 seconds to:

Keep up the outstanding work! Let's build together! 🔥

@riteshbonthalakoti
riteshbonthalakoti merged commit 358f8a3 into riteshbonthalakoti:gssoc Jun 7, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC Approved PR gssoc GirlScript Summer of Code level:advanced Advanced level difficulty quality:clean Clean code quality type:testing Testing suites, mock coverages, CI/CD integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for authStore logout flow

2 participants