test: correct onRefresh signature in MockAuthClient test-utils#262
Merged
test: correct onRefresh signature in MockAuthClient test-utils#262
Conversation
…ude currentTokens parameter Agent-Logs-Url: https://github.com/forwardsoftware/react-auth/sessions/b6f55c79-068c-4a40-8450-f5518adede3f Co-authored-by: panz3r <1754457+panz3r@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix onRefresh signature in lib test-utils to include currentTokens parameter
fix: correct onRefresh signature in MockAuthClient test-utils
Apr 4, 2026
There was a problem hiding this comment.
Pull request overview
Aligns the MockAuthClient / MockAuthClientWithHooks test utilities with the real AuthClient contract so the mocks accurately reflect how wrapAuthClient invokes onRefresh.
Changes:
- Corrected
MockAuthClient.onRefreshto accept(currentTokens, minValidity?). - Applied the same
onRefreshsignature correction toMockAuthClientWithHooks.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
panz3r
approved these changes
Apr 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Affected Package(s)
@forward-software/react-auth(lib)@forward-software/react-auth-google(packages/google-signin)Related Issue(s)
Motivation
MockAuthClientandMockAuthClientWithHooksinlib/test/test-utils.tsxdeclaredonRefreshwithout the requiredcurrentTokensfirst parameter, diverging silently from theAuthClientinterface. Anyone using these mocks as a reference would learn the wrong contract.Description of Changes
onRefreshsignature inMockAuthClientto match theAuthClientinterface:MockAuthClientWithHooks, which extendedMockAuthClientbut overrodeonRefreshwith the same incorrect signature.Breaking Changes
None
How to Test
Vitest) and build steps pass successfully on this PR.pnpm installto install dependencies.pnpm --filter @forward-software/react-auth testto run tests for the affected package.pnpm --filter @forward-software/react-auth buildto verify the build succeeds.pnpm --filter @forward-software/react-auth lintto check for linting errors.Checklist
Notes for Reviewers
No behavioural change — this is a pure signature correction in test utilities. The actual
onRefreshcall inAuthClientEnhancementsalready passesthis.tokensas the first argument (auth.tsx:385); the mocks were just misrepresenting the contract.