project 1 refactoring deep function calls #12
Merged
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.
Removed SonarCloud's warning about nested functions (fixes #447 ) by creating helper functions and calling them. Tested with lint/test and manually with console logs when interacting with UI. Edited file
public/src/client/category/tools.js
This image shows my name printed in the console on my local instance of NodeBB. Steps to trigger the print statement:
The file I refactored does not appear in the existing code coverage report. Although I attempted to write new test cases for the file, they were not compatible (
npm run lint
gave many errors), and I had no existing test cases to base my framework on.I believe that the reason why my file is not included in the code coverage in the first place is because it is executed when the user interacts with it on the front end. A user's configuration and actions vary. Thus, it is difficult to write automated tests and is best to test these code snippets with manual testing, as I have completed.