Skip to content

This is the fifth project in the second module in the Microverse program. It is an exercise for practicing unit testing in JavaScript using Jest framework & Test Driven Development.

License

Notifications You must be signed in to change notification settings

mahammad-mostafa/unit-testing-exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏷️ Unit Testing Exercise

This is the fifth project in the second module in the Microverse program.
Check the below contents for further details about this project.

📗 Contents

📖 Description

This project is an exercise for practicing unit testing using Jest framework with TDD (Test Driven Development). It contains two directories units for functions & testers for testing functions. It also includes config linters for JavaScript in the .github directory.

📌 Tech Stack:

  • Logic & functionality built with JavaScript
  • Unit testing done with Jest framework

📌 Key Features:

  • Each task has its own unit & tester file
  • All tasks are in separate test group with description text
  • Function stringLength returns a number for the input string length
  • Any string length outside the range of (1 - 10) throws an error Value out of range!
  • Three test cases are implemented in stringLength.test.js for checking valid & invalid input
  • Function reverseString returns the input string with characters in reverse order
  • One test case was done for reverseString function in reverseString.test.js
  • Object calculator contains four functions (add / subtract / multiply / divide)
  • Each function inside the calculator object has three test cases grouped together
  • Function capitalize takes a string input & returns it with first letter capitalized
  • The test cases for capitalize function was created first in capitalize.test.js
  • Any number input for capitalize function thriws an error Invalid string!

back to top

🛠️ Instructions

You can easily clone or fork this repository and work on it immadiately!

📌 Prerequisites:

  • NodeJS for installing & running all packages
  • Jest testing framework installed with:
npm i -D jest

📌 Setup:

  • Install all dependencies with npm
  • For running tests use:
npm run test

back to top

👥 Authors

📌 Mahammad:

back to top

🤝🏻 Contributions

Wish to contribute to this project?
Contributions, issues, and feature requests are more than welcome!
Feel free to check the issues page too.

back to top

⭐️ Support

Like this project? Show your support by starring!

back to top

🙏🏻 Acknowledgements

I thank everyone at Microverse for guiding me through this project.

back to top

📝 License

This project is MIT licensed.

back to top

About

This is the fifth project in the second module in the Microverse program. It is an exercise for practicing unit testing in JavaScript using Jest framework & Test Driven Development.

Topics

Resources

License

Stars

Watchers

Forks