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
fix: act warnings fix, and also fix proptypes error in CatalogNoResultsDeck #199
Conversation
@@ -38,7 +38,7 @@ const CatalogNoResultsDeck = ({ | |||
useEffect(() => { | |||
const defaultCoursesRefinements = { enterprise_catalog_query_titles: selectedCatalog, content_type: contentType }; | |||
EnterpriseCatalogApiService.fetchDefaultCoursesInCatalogWithFacets(defaultCoursesRefinements).then(response => { | |||
setDefaultData(response.default_content); | |||
setDefaultData(response.default_content || []); |
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 figured keeping this as the default value of [] was fine, since in a test, we are somehow passing undefined to setDefaultData()
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.
this fixes the proptypes warning
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.
because DataTable has set data
to be required
@@ -188,6 +188,7 @@ describe('Main Catalogs view works as expected', () => { | |||
expect(screen.queryByText(TEST_PARTNER_2)).toBeInTheDocument(); | |||
|
|||
expect(screen.queryAllByText('A la carte').length === 2); | |||
await act(() => screen.findByText('Business')); |
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.
in general, the theme here is: wait for an async activity in UI to conclude before returning test, and wrap that wait in an act(). This simulates what a user experiences and also avoid failures in tests due to side effects that may run after tests return
Codecov Report
@@ Coverage Diff @@
## main #199 +/- ##
=======================================
Coverage 81.98% 81.98%
=======================================
Files 37 37
Lines 544 544
Branches 156 157 +1
=======================================
Hits 446 446
Misses 94 94
Partials 4 4
Continue to review full report at Codecov.
|
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.
LGTM! ✅
With node16 (coming up) many of these will become errors, due to this: https://developer.ibm.com/blogs/nodejs-15-release-blog
This PR unblocks the node16 PR: #198
This PR fixes:
For all changes
Only if submitting a visual change