This project aims to practice testing JavaScript functions using Jest. It includes the implementation of several functions along with their respective tests.
To get started with this project, you'll need Node.js and npm (or yarn) installed on your machine.
- Clone this repository to your local machine.
- Install dependencies by running
npm install
oryarn install
. - Run tests using
npm run test
oryarn run test
.
- capitalize: This function capitalizes the first character of a string.
- reverseString: This function reverses a given string.
- calculator: An object containing functions for basic arithmetic operations (addition, subtraction, division, and multiplication).
- caesarCipher: This function applies the Caesar cipher to a given string based on a shift factor.
- analyzeArray: This function takes an array of numbers and returns an object with properties: average, min, max, and length.
Each function has corresponding test suites located in the __tests__
directory. Tests are written using Jest.
You can run tests using the command npm run test
or yarn run test
. This will execute all test suites and display the results in your console.
- Ensure that you have followed the instructions for configuring Jest to handle ES6 import statements if you encounter any issues.
Happy testing!