Skip to content
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

Include unit tests for default plugins #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tlylt
Copy link
Owner

@tlylt tlylt commented Aug 5, 2021

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • Others, please explain:

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 mock fs and child_process modules such that generateDiagram will not actually launch plantuml.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 the expected/diagrams folder. I did not unit test the generateDiagram 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 into packages/core/test/unit/plugins/default and run
npx jest anchor.test.js, or
npx jest plantuml.test.js, or
npx 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 the
node passing in according to a plugin's purpose.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No blatantly unrelated changes
  • Pinged someone for a review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant