test(*): assert exact values instead of loose matchers#11057
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit a73f841
☁️ Nx Cloud last updated this comment at |
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughTests across Lit Query, Query Core, Devtools, and Vue Query now assert exact error values, warning metadata, and thrown messages instead of generic error matchers. ChangesError assertion tightening
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Contributor
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
Contributor
size-limit report 📦
|
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.
🎯 Changes
Several tests used loose matchers that pass as long as something is present, without checking the actual value. Where the thrown/forwarded value is deterministic (thrown by the test itself, or a fixed source message), the assertions are tightened to the exact value.
lit-query—infinite-and-options,mutation-controller—toBeInstanceOf(Error)→toEqual(new Error('<message>')). Each error is thrown by the test's ownqueryFn/mutationFn(next-page-failed,negative-not-allowed,reset-target), and the siblingrejects.toThrow('<message>')already checks the same message, so theerrorobject is now checked to match it too.query-core—timeoutManager— the second argument of the provider-switch warning wasexpect.anything()(any non-null value); it now asserts the exact{ previous, provider }payload the source passes.query-devtools—Explorer— the clipboard copy failure logsconsole.error('Failed to copy: ', err);expect.any(Error)→ the exactnew Error('denied')the test'swriteTextmock rejects with.vue-query—useQueryClient— baretoThrow()→toThrow('<message>')for the two guards (No 'queryClient' found ...andvue-query hooks can only be used inside setup() ...), which the source throws unconditionally.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit