Merged
Conversation
commit: |
There was a problem hiding this comment.
Pull request overview
This PR updates and stabilizes several hook test suites, primarily by improving mock implementations and aligning expectations with current Vitest matcher APIs.
Changes:
- Refined test mocks for
ResizeObserverandIntersectionObserverto be more deterministic across test runs. - Standardized multiple assertions from deprecated/alias matchers (e.g.
toBeCalled) totoHaveBeenCalled. - Cleaned up test/snapshot output for
useResponsiveand adjusted auseAntdTabletest to render within a component context.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/hooks/src/useSize/tests/index.spec.tsx | Improves ResizeObserver mocking and resets shared callback state between tests. |
| packages/hooks/src/useResponsive/tests/index.spec.ts | Simplifies renderHook usage to avoid wrapper function. |
| packages/hooks/src/useResponsive/tests/snapshots/index.spec.ts.snap | Removes obsolete snapshot entries matching updated test naming. |
| packages/hooks/src/useRequest/tests/useCachePlugin.spec.tsx | Updates spy assertion to toHaveBeenCalled. |
| packages/hooks/src/useRafTimeout/tests/node.spec.ts | Updates assertion to not.toHaveBeenCalled. |
| packages/hooks/src/useRafTimeout/tests/index.spec.ts | Updates multiple assertions to toHaveBeenCalled variants. |
| packages/hooks/src/useRafInterval/tests/node.spec.ts | Minor formatting + matcher update to not.toHaveBeenCalled. |
| packages/hooks/src/useLongPress/tests/index.spec.ts | Updates several call-count assertions to toHaveBeenCalled*. |
| packages/hooks/src/useKeyPress/tests/index.spec.tsx | Formats key event payloads and updates one matcher to toHaveBeenCalled. |
| packages/hooks/src/useInViewport/tests/index.spec.ts | Reworks IntersectionObserver mocking with callback capture and per-test reset. |
| packages/hooks/src/useInterval/tests/index.spec.ts | Updates several matchers to toHaveBeenCalled*. |
| packages/hooks/src/useCountDown/tests/index.spec.ts | Updates onEnd assertions to toHaveBeenCalled. |
| packages/hooks/src/useAntdTable/tests/index.spec.ts | Fixes manual/defaultParams test by rendering a setup component and asserting via waitFor. |
💡 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.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self Check before Merge