test: add payment configs mock handler and improve transition test - #2560
Open
serikjensen wants to merge 3 commits into
Open
test: add payment configs mock handler and improve transition test#2560serikjensen wants to merge 3 commits into
serikjensen wants to merge 3 commits into
Conversation
The submission test was intermittently failing on CI because react-aria DateSegment spinbuttons process keystrokes asynchronously. Under CI load, the year value had not committed to react-aria's internal state before the form was submitted, causing zod validation to reject the null checkDate. Wait for the year segment's aria-valuenow to settle before clicking submit, and extend the mutation-completion waitFor timeout to 5 seconds for slow CI runners. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o
The payment_configs endpoint had a fixture file but no MSW handler, causing unhandled requests to hit the real network during tests. After a successful mutation, TanStack Query's global onSuccess awaits invalidateQueries which refetches all mounted queries — including the unhandled payment_configs request. The variable network latency caused mutateAsync to block unpredictably, making any test that submits a form with useCompanyPaymentSpeed mounted flaky. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o
The 5s timeout was a workaround for the missing MSW handler, which is now fixed. The default 1000ms waitFor is sufficient when all queries resolve through MSW. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o
dmortal
approved these changes
Aug 14, 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.
Summary
Adds mock API handler for the payment configs endpoint and improves test reliability in the TransitionCreation component by adding an explicit wait for year input value synchronization.
Changes
getPaymentConfigsmock handler forGET /v1/companies/:company_uuid/payment_configsendpoint that loads response data from a fixture filewaitForassertion in TransitionCreation test to ensure the year spinbutton value is synchronized before proceeding with form submissionTesting
Existing tests pass. The new mock handler is automatically used by tests that call the payment configs endpoint via the mock service worker setup. The TransitionCreation test improvement ensures the year input has the expected value before the continue button is clicked, reducing flakiness from timing issues.
https://claude.ai/code/session_0115RDitt4U8ajpBnBNd8W8o