-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
test(query-core): add test case for hydration #8949
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit 5839e07.
☁️ Nx Cloud last updated this comment at |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8949 +/- ##
===========================================
+ Coverage 44.09% 58.35% +14.25%
===========================================
Files 201 137 -64
Lines 8025 5312 -2713
Branches 1762 1392 -370
===========================================
- Hits 3539 3100 -439
+ Misses 4058 1921 -2137
+ Partials 428 291 -137 🚀 New features to boost your workflow:
|
try { | ||
await dehydrated.queries[0]?.promise | ||
expect(true).toBe(false) | ||
} catch (error) { | ||
expect(error).toBe(testError) | ||
} |
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 think this should be:
await expect(dehydrated.queries[0]?.promise).rejects.toBe(testError)
const originalNodeEnv = process.env.NODE_ENV | ||
process.env.NODE_ENV = 'production' |
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.
why is that needed?
process.env.NODE_ENV = originalNodeEnv | ||
consoleMock.mockRestore() | ||
await promise | ||
queryClient.clear() |
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.
instead of clearing the queryClient at the end, let’s just not share a client between tests but have each test instantiate their own please.
improve test coverage of
hydration.ts
from 85% to 100%.Before
After