Include unit tests for default plugins #2
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.
What is the purpose of this pull request?
Overview of changes:
This PR partially addresses MarkBind#781. I have included unit tests for default plugins as a means to complement existing functional tests.
Anything you'd like to highlight / discuss:
In the unit test for
markbind-plugin-plantuml
, I decided to mockfs
andchild_process
modules such thatgenerateDiagram
will not actually launchplantuml.jar
to convert plantuml code into an image file. This is because that process seems to be covered in functional tests as plantuml diagrams will be generated in theexpected/diagrams
folder. I did not unit test thegenerateDiagram
function because it is not an exported function. I am not sure if that is a good reason but I am thinking since it is somewhat private and inaccessible to other modules, perhaps I should not test it.Testing instructions:
Run
npm run test
to verify that all tests are still passing. To only run the 3 added tests, cd intopackages/core/test/unit/plugins/default
and runnpx jest anchor.test.js
, ornpx jest plantuml.test.js
, ornpx jest shorthandSyntax.test.js
Proposed commit message: (wrap lines at 72 characters)
Include unit tests for default plugins
There are severe plugins that have specific functionalities
but are not unit tested.
Some of the edge cases might be harder to test with functional tests.
Let's add unit tests for default plugins to verify their functionalities.
For example,
processNode
should correctly modify thenode
passing in according to a plugin's purpose.Checklist: ☑️