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.
Checklist before requesting a review
Description
The current plain JS scripts are probably stable but adding these tests should still help, especially if they get redone in an upcoming version.
An additional perk is that it forces me to review the current functions in the scripts and I can identify which ones could be removed in the next major version rather than being migrated/refactored. For
common.jsthere are at least 17% of functions that are unused or could be easily be replaced by better alternatives.It isn't my intention to test everything, in fact it isn't even possible without complex mocks, but I've been caught up on the current test coverage and for Jest tests it has been sitting at around just 13% for a while now. I am not sure E2E tests cover a lot of it either. Even if they are changed to ESM/Vue code later, these tests are likely to still be useful.
Jest tests have been changed to output the code coverage now. Even though it isn't tracked in a central location, it would be nice to be able to see it at least in the CI runs.
The only code changes here are:
donetothenon jQuery AJAX calls for compatibility with the AJAX mock system in the tests. Functionality should remain the same.innerTexttotextContentasinnerTextis not implemented in JSDom. There are some differences, but none that should matter in the context of the system information.module.exportsis defined. In other words, some functions that are tested are exported using node's module system when in the test environment. This avoids the need to explicitly add the functions to thewindow. Should have no effect in the browser.