Skip to content

odilson-dev/testing-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Testing Practice with Jest

This project aims to practice testing JavaScript functions using Jest. It includes the implementation of several functions along with their respective tests.

Getting Started

To get started with this project, you'll need Node.js and npm (or yarn) installed on your machine.

  1. Clone this repository to your local machine.
  2. Install dependencies by running npm install or yarn install.
  3. Run tests using npm run test or yarn run test.

Functions Implemented

  1. capitalize: This function capitalizes the first character of a string.
  2. reverseString: This function reverses a given string.
  3. calculator: An object containing functions for basic arithmetic operations (addition, subtraction, division, and multiplication).
  4. caesarCipher: This function applies the Caesar cipher to a given string based on a shift factor.
  5. analyzeArray: This function takes an array of numbers and returns an object with properties: average, min, max, and length.

Testing

Each function has corresponding test suites located in the __tests__ directory. Tests are written using Jest.

Running Tests

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.

Additional Notes

  • Ensure that you have followed the instructions for configuring Jest to handle ES6 import statements if you encounter any issues.

Happy testing!