This project is part of an internship assignment at Foothill, focused on developing a JavaScript calculator with an emphasis on writing comprehensive unit tests. The calculator supports basic arithmetic operations such as addition, subtraction, multiplication, and division, and includes robust input validation.
- Performs addition, subtraction, multiplication, and division.
- Validates input types and operators to ensure correct calculations.
- Handles edge cases like division by zero and numbers greater than 1000, which are ignored.
- Developed with test-driven development techniques to ensure functionality and reliability.
To use the calculator, require the module in your JavaScript code and pass parameters as follows:
{
num1: <number>,
operation1: <string>,
num2: <number>,
operation2: <string, optional>,
num3: <number, optional>
}
The calculator executes the operations in sequence and returns the computed result.
Clone this repository to your local machine to get started. Ensure you have Node.js installed to run the calculator.
The project includes a calculator.test.js
file, which demonstrates how to write unit tests for each function and scenario. It is a vital part of the internship's focus on learning test-driven development and achieving high code quality.
- This task is part of the Foothill Technology Solutions Internship Cycle.
- Big thanks to my trainer @Huthaifa
Thank you for visiting my project! Feel free to star or contribute to the repository if you find it useful.