Skip to content

test: add auth, application, and theme preference hooks tests#153

Closed
jakebromberg wants to merge 2 commits intomainfrom
test/08-auth-theme-hooks
Closed

test: add auth, application, and theme preference hooks tests#153
jakebromberg wants to merge 2 commits intomainfrom
test/08-auth-theme-hooks

Conversation

@jakebromberg
Copy link
Copy Markdown
Member

@jakebromberg jakebromberg commented Feb 5, 2026

Closes #253

Summary

Add ~107 tests covering the React hooks that bridge auth, application state, and theme preferences to components:

  • Authentication hooksuseLogin, useLogout, useAuthentication (async org-role fetch), useRegistry, useNewUser, useResetPassword (handleRequestReset, handleReset)
  • Application hooksuseWindowSize, usePublicRoutes, useShiftKey, useAlbumImages, resetApplication
  • Theme preference hooks — Theme preference synchronization between local storage and server

These hooks contain the async org-role resolution logic (see memory notes on useAuthentication), so tests use waitFor for the async state update.

Test plan

  • Run npm test src/hooks/authenticationHooks.test.ts src/hooks/themePreferenceHooks.test.ts

Part 8 of 26

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 5, 2026

Deploying wxyc-dj with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5d7fe6c
Status: ✅  Deploy successful!
Preview URL: https://0df38c35.dj-site.pages.dev
Branch Preview URL: https://test-08-auth-theme-hooks.dj-site.pages.dev

View logs

@jakebromberg jakebromberg force-pushed the test/08-auth-theme-hooks branch from 199090e to 7a446d2 Compare February 5, 2026 21:26
@jakebromberg jakebromberg marked this pull request as ready for review February 6, 2026 00:55
- Add comprehensive tests for authentication hooks
- Add tests for application state hooks
- Add tests for theme preference synchronization
- Add inline createHookWrapper (not yet available from test-utils on main)
- Add organization-utils mock to prevent real org lookups
- Use waitFor for async role fetch in useAuthentication/useRegistry tests
@jakebromberg jakebromberg force-pushed the test/08-auth-theme-hooks branch from 7a446d2 to 5d7fe6c Compare February 14, 2026 20:31
@jakebromberg jakebromberg deleted the test/08-auth-theme-hooks branch March 26, 2026 04:25
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 tests for auth, application, and theme preference hooks

2 participants