Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mahammad-mostafa/unit-testing-exercise
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.
https://github.com/mahammad-mostafa/unit-testing-exercise
arrange-act-assert arrow-functions es6 javascript jest jest-matchers npm-scripts tdd-javascript test-automation test-driven-development testing testing-framework testing-tools
Last synced: 28 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/mahammad-mostafa/unit-testing-exercise
- Owner: mahammad-mostafa
- License: mit
- Created: 2023-07-20T23:18:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-21T16:32:02.000Z (over 1 year ago)
- Last Synced: 2024-10-08T21:52:26.668Z (about 1 month ago)
- Topics: arrange-act-assert, arrow-functions, es6, javascript, jest, jest-matchers, npm-scripts, tdd-javascript, test-automation, test-driven-development, testing, testing-framework, testing-tools
- Language: JavaScript
- Homepage:
- Size: 110 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 🏷️ 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](#description)
- [Instructions](#instructions)
- [Authors](#authors)
- [Contributions](#contributions)
- [Support](#support)
- [Acknowledgements](#acknowledgements)
- [License](#license)# 📖 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!`# 🛠️ 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
```# 👥 Authors
📌 **Mahammad:**
- [GitHub](https://github.com/mahammad-mostafa)
- [Twitter](https://twitter.com/mahammad_mostfa)
- [LinkedIn](https://linkedin.com/in/mahammad-mostafa)# 🤝🏻 Contributions
Wish to contribute to this project?
Contributions, issues, and feature requests are more than welcome!
Feel free to check the [issues](../../issues) page too.# ⭐️ Support
Like this project? Show your support by starring!
# 🙏🏻 Acknowledgements
I thank everyone at **Microverse** for guiding me through this project.
# 📝 License
This project is [MIT](LICENSE.md) licensed.