@sjeremich23/tests

1.0.5 • Public • Published

🧪 Backend API Validation Middleware Tests

This project includes a comprehensive set of tests for the middleware functions provided in the @sjeremich23/pwa-utils package. These tests ensure that the validation functions for name, email, phone number, birthday, and password work as expected.

✨ Features

  • API Reachability Test: Verifies that the API is reachable and running on port 3000.
  • User Signup Endpoint Definition Test: Verifies that the user signup endpoint is defined and setup correctly at the URL path "/signup".
  • User Signup with Valid Data Test: Verifies that the user signup endpoint works correctly with valid data.
  • User Signup with Invalid Email Test: Verifies that the user signup endpoint correctly handles invalid email addresses.
  • User Signup with Invalid Phone Number Test: Verifies that the user signup endpoint correctly handles invalid phone numbers.
  • User Signup with Invalid Birthday Test: Verifies that the user signup endpoint correctly handles invalid birthdays.
  • User Signup with Invalid Password Test: Verifies that the user signup endpoint correctly handles invalid passwords.

📦 Installation

To install the package and its dependencies, use npm:

npm install @sjeremich23/tests

If you want to run the tests, you need to install Jest:

npm install --save-dev jest

Then, add a test script to your package.json:

{
  "scripts": {
    "test": "jest"
  }
}

🚀 Running Tests

To run the tests provided by the @sjeremich23/tests package, follow these steps:

  1. Create a Test File: Create a test file in your project directory, for example, your-test-name.test.js.

  2. Import the Test Suite: In your test file, import the test suite from the @sjeremich23/tests package:

    require("@sjeremich23/tests");
  3. Run the Tests: Use the following npm script to run the tests:

    npm run test

Make sure you have Jest installed and configured in your project as described in the installation instructions.

Readme

Keywords

Package Sidebar

Install

npm i @sjeremich23/tests

Weekly Downloads

3

Version

1.0.5

License

MIT

Unpacked Size

5.28 kB

Total Files

3

Last publish

Collaborators

  • sjeremich23