Step 1: Choosing Jest
Last week was rough and I had to fix code before doing Lab 8. Basically, we are implementing Automated Testing to our existing ssg I chose to use Jest because I am using Node.js as my main language. I feel like this week I was completely burnt out and needed a few days to rest.
I use npm install to install jest and added the following two lines to package.json
Step 2: First Tests
My first set of tests involve file checking, whether a path is a file, folder and nothing related to the files I needed, which are ".md" and ".txt".
STEP 3: Test the Core of SSG
My next set of tests involve whether I utilized the correct input files.
Running my tests yielded the following results on Jest.
Step 4: Updating Documentation
I updated the CONTRIBUTION.md file
Step 6: Merging to Master
Conclusion
I learnt that writing test for existing code that does not have tests is much harder than writing tests from the start. I feel like I have to refactor some of my code in order for my tests to run. I believe the benefit of this open-source class and community is that you can ask questions and help each other out during harder labs and releases. I have done testing before, but not with Jest, so it was a good experience.
Live to code another day...
No comments:
Post a Comment