/Jest

Learning test driven development using jest, a TOP course

Primary LanguageJavaScript

Odin Project - Testing with Jest

Overview

This project is part of The Odin Project curriculum. It focuses on writing JavaScript functions and testing them using Jest. The following functions were implemented and tested:

  • capitalize: Capitalizes the first letter of a string.
  • reverseString: Reverses a given string.
  • calculator: A basic calculator object with methods for addition, subtraction, multiplication, and division.
  • caesarCipher: Shifts each letter in a string by a given number of positions in the alphabet.
  • analyzeArray: Returns an object with the average, min, max, and length of an array of numbers.

Functions

1. capitalize(string)

  • Capitalizes the first letter of the given string.

2. reverseString(string)

  • Reverses the input string.

3. calculator

  • An object with methods:
    • add(a, b)
    • subtract(a, b)
    • multiply(a, b)
    • divide(a, b)

4. caesarCipher(string, shift)

  • Shifts each letter in the string by the specified shift value.

5. analyzeArray(array)

  • Takes an array of numbers and returns an object with:
    • average
    • min
    • max
    • length

Running Tests

  1. Install dependencies:

    npm install
  2. Run tests with Jest:

    npm test

License

This project is part of The Odin Project.


This version of the README provides just the basic information to understand the project and how to run the tests.