-
Notifications
You must be signed in to change notification settings - Fork 99
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
Implement bulk export query and abstract bulk methods into own import #2279
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2279 +/- ##
==========================================
+ Coverage 54.73% 54.89% +0.15%
==========================================
Files 1093 1093
Lines 26556 26603 +47
Branches 7534 7570 +36
==========================================
+ Hits 14536 14603 +67
+ Misses 10913 10895 -18
+ Partials 1107 1105 -2
Continue to review full report at Codecov.
|
d9db157
to
fec54d4
Compare
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.
So we have bulkactions now that contain the BulkTagComponent, useBulkExportEntities and useBulkDeleteEntities, right? There are tests for the BulkTagComponent but I don't see any for useBulkExportEntities and useBulkDeleteEntities. We should test those too if possible.
The task listpage contains a test "should allow to export all displayed tasks". Parts of the test are commented out because the bulk actions were still missing. Shouldn't this work now, since bulk export for tasks is implemented? (Also "should allow to export all displayed tasks" is probably not the best title because bulk delete seems to be tested as well.)
You're right. If we didn't abstract the functionality from just tasks alone then it would be simple. As such I'm not quite sure how to test these functions. I'll have to think about that a little more. I remember several weeks ago I wasn't able to come up with a way.
I don't think it should because stuff like that used to be from gmp, so we can check from the listpage if they are called. Now it's a graphql function. I can try to see if I can put the mock into the listpage test and get rid of the old tests. |
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 guess for useBulkExportEntities you would "just" need to test the hook with some simple mock functions for exportByFilterFunc and exportByIdsFunc and test if for each selectionType the correct function is called and returns the correct entities. But I realize that this might be a little more tricky than it looks.
Oh of course the listpage tests need to be adapted to graphQL. I think at least for bulk export this should work. Bulk delete is using refetch, though, and that seems to always break the tests, so we might not be able to test that right now.
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.
For me it looks good. I am just not sure about the error cases mentioned in the code comment.
7dee781
to
fc0e187
Compare
12eb532
to
7542f95
Compare
Co-authored-by: Björn Ricks <bjoern.ricks@greenbone.net>
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.
The tests look really good, I think we have a pretty good coverage now.
const [deleteTasksByIds] = useDeleteTasksByIds(); | ||
const [deleteTasksByFilter] = useDeleteTasksByFilter(); |
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.
The indentation still seems to be wrong here. Maybe a bug in prettier...
Checklist: