This repository is a collection of Test-Driven Development (TDD) Katas and Legacy Refactoring Katas, designed to write clean, maintainable, and testable code.
-
Refactor Legacy Code: Improve the structure and quality of existing codebases without changing their external behavior.
-
Promote TDD Practices: Encourage the habit of writing tests before implementing functionality.
- Use FIRST Principles
- Use Red-Green-Refactor
- Boundary Testing
- Fake It (Till You Make It)
- Learning Tests
- One to many
- Triangulation
- Backout
- Test Doubles
This excercise focusses on improving poorly written code while preserving functionality. Examples include:
These exercises are aimed at practicing TDD principles by building solutions incrementally with tests. Examples include:
-
Clone the Repository:
git clone https://github.com/Zafeer/tdd-refactor-legacy.git cd tdd-refactor-legacy -
Set Up the Environment: Install the necessary dependencies for Typescript (i.e. NodeJS if not already installed). Preconfigured with linting and formatting
npm i
-
Pick an Exercise: Navigate to the desired kata directory and follow the README for specific instructions.
-
Write Tests: Start by writing approval tests(if legacy), failing tests, implement functionality, and refactor iteratively.
-
Run Tests: Use vitest to verify your solution:
npm run test:watch # JavaScript/TypeScript