New testing system has been added to OSD600-SSG. This feature will be beneficial for the current developers to prevent bugs that might happen and for future contributers who would like to test the tool.
npm install --save-dev jest
package.json I create a script that will
test so test can be run by:
npm run test npm run test <folder name or file name>
Note: Before create any test, create a folder name
test and put test files to it.
I created a new branch called
testing. After setting up Jest, I created 2 big tests, one that would test command-line that users pass in the terminal, and the other one would test the function that convert markdown files. I wrote my test as details as possible. Example, I wrote tests for every
Also provided a lot of input type (null, 1-line, multiple lines) for testing the markdown converter function:
This helped me a lot since I realized that I made a lot of mistakes, one of those was in my
if statement (
&& instead of
||). After all tests were passed, I commit and push my final version to main.