-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
test: add case for key only changes with immediate: false
#32473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There was a problem hiding this 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 adds tests to verify that useAsyncData behaves correctly when the key changes while immediate is set to false, and introduces a new (incomplete) test case for useFetch refetch behavior.
- Added a test in useAsyncData to ensure that no execution occurs when only the key changes with immediate: false.
- Introduced a placeholder test for useFetch refetch behavior.
Comments suppressed due to low confidence (1)
test/nuxt/composables.test.ts:916
- The test case 'should refetch' appears incomplete with no implementation or assertions. Consider completing the test to ensure it covers the intended refetch behavior.
it('should refetch ')
test/nuxt/composables.test.ts
Outdated
|
||
it('should refetch ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should refetch ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to add the same test for useFetch, but since we are using experimental.alwaysRunFetchOnKeyChange: true
for tests, so I had to test the opposite. 👍🏽
WalkthroughTwo new test cases were added to the test suite. The first test in the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
test/nuxt/composables.test.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.ts`: Follow standard TypeScript conventions and best practices
**/*.ts
: Follow standard TypeScript conventions and best practices
📄 Source: CodeRabbit Inference Engine (.github/copilot-instructions.md)
List of files the instruction was applied to:
test/nuxt/composables.test.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: codeql (javascript-typescript)
- GitHub Check: codeql (actions)
- GitHub Check: build
- GitHub Check: code
🔇 Additional comments (1)
test/nuxt/composables.test.ts (1)
747-759
: Well-implemented test case for the specified scenario.This test correctly validates that when
immediate: false
is set, changing only the reactive key does not trigger the async data fetch function. The implementation properly uses mocking, reactive refs, and appropriate assertions to verify the expected behaviour.
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #32473 will not alter performanceComparing Summary
|
🔗 Linked issue
📚 Description
This PR introduces a small test for asyncData to track the
immediate: false
behaviour when key is changed, without altering any watch sources.