Skip to content

test: fix test case#2927

Merged
li-jia-nan merged 8 commits intomasterfrom
test-ci-fix
Apr 8, 2026
Merged

test: fix test case#2927
li-jia-nan merged 8 commits intomasterfrom
test-ci-fix

Conversation

@li-jia-nan
Copy link
Copy Markdown
Collaborator

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English test: fix test case
🇨🇳 Chinese test: fix test case

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copilot AI review requested due to automatic review settings April 7, 2026 21:28
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 7, 2026

npm i https://pkg.pr.new/ahooks@2927
npm i https://pkg.pr.new/@ahooks.js/use-url-state@2927

commit: 45c0980

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ResizeObserver and IntersectionObserver to be more deterministic across test runs.
  • Standardized multiple assertions from deprecated/alias matchers (e.g. toBeCalled) to toHaveBeenCalled.
  • Cleaned up test/snapshot output for useResponsive and adjusted a useAntdTable test 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.

Copy link
Copy Markdown
Collaborator

@liuyib liuyib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@li-jia-nan li-jia-nan merged commit 6c2da25 into master Apr 8, 2026
18 checks passed
@li-jia-nan li-jia-nan deleted the test-ci-fix branch April 8, 2026 06:34
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.

3 participants