-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add unit test for useFetchAgentFrameworkTraces Hook #77
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #77 +/- ##
==========================================
+ Coverage 75.39% 83.52% +8.13%
==========================================
Files 43 43
Lines 1024 1026 +2
Branches 238 239 +1
==========================================
+ Hits 772 857 +85
+ Misses 251 168 -83
Partials 1 1 ☔ View full report in Codecov by Sentry. |
@@ -33,7 +33,7 @@ export const useFetchAgentFrameworkTraces = (traceId: string) => { | |||
.catch((error) => dispatch({ type: 'failure', error })); | |||
|
|||
return () => abortController.abort(); |
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.
Shall we add one test case for assert this abort method has been called after unmount.
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.
sure, case added.
Signed-off-by: Hailong Cui <ihailong@amazon.com>
Signed-off-by: Hailong Cui <ihailong@amazon.com>
}) | ||
); | ||
|
||
waitFor(() => { |
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 line seems problematic, if I put await waitFor
, the test will failed, and also I see a console error on this test
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.
Add a condition check for unmount to remediate console log error about [Can't perform a React state update on an unmounted component]
.catch((error) => {
if (error.name === 'AbortError') return;
dispatch({ type: 'failure', error });
});
Signed-off-by: Hailong Cui <ihailong@amazon.com>
Description
Add unit test for useFetchAgentFrameworkTraces
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.