An open API service indexing awesome lists of open source software.

https://github.com/hayaaburaed/simple-string-calculator

🧮 A simple JavaScript string calculator designed for learning unit testing with Jest.
https://github.com/hayaaburaed/simple-string-calculator

javascript jest unit-testing

Last synced: 3 months ago
JSON representation

🧮 A simple JavaScript string calculator designed for learning unit testing with Jest.

Awesome Lists containing this project

README

          

# Simple String Calculator
This is a simple string calculator implemented in JavaScript project, that serves as a task aimed at learning JavaScript unit testing with Jest. The calculator function, calc, accepts mathematical expressions in the form of strings and evaluates them to return the result. The calculator supports basic arithmetic operations such as addition, subtraction, multiplication, and division.


## 🧮 Features
- Supports addition, subtraction, multiplication, and division.
- Handles negative numbers and decimal numbers correctly.
- Follows the correct order of operations.
- Throws errors for division by zero, invalid operators, and invalid input types.
- Ignores numbers larger than 1000 when adding.
- Comprehensive unit tests using Jest for ensuring functionality and reliability.
- Achieves 100% test coverage to validate all aspects of the calculator function.


## 📥 Installation
Clone the repository:
``` bash
git clone https://github.com/your-username/simple-string-calculator.git
```

Navigate to the project directory:
``` bash
cd simple-string-calculator
```

Install dependencies:
``` bash
npm install
```


## ✨ Have a Look
Running: ``` npm test ``` we get:


vs-coverage        
coverage




##


✨ I'll be glad seeing your feedback, feel free to reach out! ✨