An open API service indexing awesome lists of open source software.

https://github.com/tatilimongi/passchecker

A TypeScript-based password validation tool following Test-Driven Development (TDD) principles, tested with Jest
https://github.com/tatilimongi/passchecker

best-practices jest password-validation software-testing tdd tdd-kata testing typescript unit-testing

Last synced: 2 months ago
JSON representation

A TypeScript-based password validation tool following Test-Driven Development (TDD) principles, tested with Jest

Awesome Lists containing this project

README

          

# Password Checker

![GitHub repo size](https://img.shields.io/github/repo-size/tatilimongi/PassChecker)
![License](https://img.shields.io/github/license/tatilimongi/PassChecker?style=flat-square)
![Languages](https://img.shields.io/github/languages/top/tatilimongi/PassChecker)
![Node Version](https://img.shields.io/node/v/jest)

## Description
This project is a **Password Checker** implemented in **TypeScript**. It was developed as an exercise to practice **Test-Driven Development (TDD)** and **Jest** for unit testing.

## Password Validation Rules
A password is **invalid** if:
- It has **less than 8 characters**.
- It **does not contain an uppercase letter**.
- It **does not contain a lowercase letter**.

### Additional Requirement for Admin Passwords
- An **admin password must also contain at least one number**.

## Project Structure
```
├── src
│ ├── app
│ │ ├── PasswordChecker.ts # Implementation of the password checker
│ ├── test
│ │ ├── PasswordChecker.test.ts # Jest test cases
├── node_modules/ # Dependencies (not included in the repository)
├── coverage/ # Test coverage reports (generated by Jest)
├── jest.config.ts # Jest configuration
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── LICENSE # MIT License
└── README.md # Project documentation
```

## Installation and Setup
### Prerequisites
Make sure you have **Node.js** and **npm** installed on your machine.

### Clone the Repository
```sh
git clone https://github.com/tatilimongi/PassChecker.git
cd PassChecker
```

### Install Dependencies
```sh
npm install
```

## Running Tests
The project uses **Jest** for unit testing. To execute the tests, run:
```sh
npm test
```

## Jest Configuration
The `jest.config.ts` file contains the following configuration:
```typescript
import type {Config} from '@jest/types';

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
verbose: true,
collectCoverage: true,
collectCoverageFrom: [
'/src/app/**/*.ts'
]
};

export default config;
```

## License
This project is licensed under the **MIT License**.