Skip to content

test: add unit tests for the 401 response interceptor in lib/api.ts - #290

Merged
martinzhames merged 1 commit into
dupdab:mainfrom
Xaxxoo:fix/issue-129-response-interceptor-tests
Sep 1, 2026
Merged

test: add unit tests for the 401 response interceptor in lib/api.ts#290
martinzhames merged 1 commit into
dupdab:mainfrom
Xaxxoo:fix/issue-129-response-interceptor-tests

Conversation

@Xaxxoo

@Xaxxoo Xaxxoo commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add unit tests for the 401 response interceptor in src/lib/api.ts
  • Tests verify: auth state is cleared and redirect to /auth/login occurs on 401 responses, legacy access_token is removed from localStorage, non-401 errors pass through without clearing auth or redirecting, errors with no response property are handled gracefully

Test plan

  • Run npm test and verify all new tests pass
  • Verify 401 responses trigger logout and redirect to /auth/login
  • Verify non-401 errors (403, 404, 500) do not affect auth state or trigger redirect

Closes #129

Generated with Claude Code

Closes dupdab#129

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Xaxxoo 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! 🚀

Learn more about application limits

@martinzhames
martinzhames merged commit d169a03 into dupdab:main Sep 1, 2026
1 check failed
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 unit tests for the 401 response interceptor in lib/api.ts

2 participants