@sjeremich23/tests
v1.0.5
Published
A NPM package for testing purposes
Readme
🧪 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/testsIf you want to run the tests, you need to install Jest:
npm install --save-dev jestThen, 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:
Create a Test File: Create a test file in your project directory, for example,
your-test-name.test.js.Import the Test Suite: In your test file, import the test suite from the
@sjeremich23/testspackage:require("@sjeremich23/tests");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.
