Merged
Conversation
…...CalledExactlyOnceWith`
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@barso/forms
@barso/helpers
@barso/hooks
@barso/infra
@barso/ui
commit: |
There was a problem hiding this comment.
Pull request overview
This PR refactors multiple files across the codebase to improve code quality and maintainability. The changes include updating test assertions to use more concise Vitest matchers, converting mock functions to proper constructor functions, simplifying React components by removing unnecessary state management, and replacing mutations with immutable patterns.
Key changes:
- Converted arrow function mocks to constructor functions for proper class instantiation behavior
- Updated test assertions to use
toHaveBeenCalledOnce()andtoHaveBeenCalledExactlyOnceWith()for improved readability - Refactored
useTreeCollapsehook fromuseStatetouseReducerfor better state management - Simplified
MarkdownViewerby removing unnecessary state management - Replaced object mutation with immutable spread operator in
SubmittedFields - Added
adoptedStyleSheetspolyfill for jsdom compatibility
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/setup.js | Added adoptedStyleSheets polyfill for jsdom environment to fix compatibility issue |
| packages/ui/src/_document.test.js | Converted ServerStyleSheet mock from arrow function to constructor function for proper instantiation |
| packages/ui/src/Notifications/NotificationMenu.test.jsx | Updated test assertion to use toHaveBeenCalledOnce() |
| packages/ui/src/Notifications/NotificationList.test.jsx | Updated test assertions to use toHaveBeenCalledOnce() |
| packages/ui/src/Markdown/Markdown.jsx | Removed unnecessary state management in MarkdownViewer, replaced Box with div, removed unused imports |
| packages/ui/src/GoToTopButton/GoToTopButton.test.jsx | Updated mock to constructor function and test assertions to use toHaveBeenCalledExactlyOnceWith() |
| packages/ui/src/FormField/FormField.test.js | Updated test assertion to use toHaveBeenCalledOnce() |
| packages/ui/src/FormField/FormField.jsx | Moved ref assignment after spread operator to prevent accidental override |
| packages/infra/src/logger/logger.test.js | Converted Axiom mock from arrow function to constructor function and hoisted flush mock |
| packages/infra/src/logger/axiom-transport.test.js | Converted Axiom mocks to constructor functions and updated test assertions |
| packages/hooks/src/useTreeCollapse/useTreeCollapse.js | Refactored from useState/useCallback to useReducer for cleaner state management |
| packages/helpers/src/dom.test.js | Updated test assertion to use toHaveBeenCalledOnce() |
| examples/form/components/SubmittedFields.jsx | Replaced delete mutation with immutable spread operator pattern |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.