A hands-on exploration of Test-Driven Development (TDD) using Jest as part of The Odin Project curriculum. This repository documents my learning journey through writing comprehensive unit tests for various JavaScript functions.
- String Utilities - capitalize() and reverseString() functions with full test coverage
- Calculator Object - Basic arithmetic operations (add, subtract, multiply, divide) with comprehensive tests
- Caesar Cipher - Character shifting cipher with case preservation and wrapping logic
- Array Analysis - Statistical analysis function returning average, min, max, and length
- Test-Driven Development - All functions implemented using TDD methodology with Jest
Want to run this project locally? Here's how:
- Node.js (version 14 or higher)
- npm (comes with Node.js)
- Basic understanding of JavaScript and unit testing
- Clone the repository
git clone https://github.com/top-submissions/fullstackjs-testing-practice.git
cd fullstackjs-testing-practice- Install dependencies
npm install- Verify installation
npm testRun all tests:
npm testRun tests in watch mode:
npm test -- --watchRun tests with coverage:
npm test -- --coverageIf I were to continue working on this project, here's what I'd add:
- Add edge case tests for division by zero
- Implement integration tests for combined function usage
- Add performance benchmarks for array analysis with large datasets
- Implement additional cipher algorithms (ROT13, Vigenère)
- Add TypeScript support with type definitions
- Create visual test coverage reports
- Add continuous integration with GitHub Actions
- Implement property-based testing with fast-check
- Test-Driven Development - Writing tests first helps clarify requirements and leads to better code design
- Jest Framework - Mastered Jest's testing syntax, matchers, and test organization with describe/test blocks
- Edge Case Handling - Importance of testing boundary conditions, empty inputs, and invalid data
- Code Coverage - Understanding what code coverage metrics mean and how to achieve comprehensive test coverage
- Modular Design - Structuring code into small, testable functions with single responsibilities
- Array Methods - Leveraging reduce(), map(), and spread operators for elegant solutions
- Character Encoding - Working with character codes and ASCII values for the Caesar cipher implementation
- Jest - JavaScript testing framework
- Babel - JavaScript transpiler for ES6+ support
- Node.js - JavaScript runtime environment
- ES6 Modules - Modern JavaScript module system
- Jest Documentation
- The Odin Project - Testing Basics
- The Odin Project - Testing Practice
- MDN - Array Methods
- The Odin Project - For providing an amazing free curriculum
Built with 💡 and ☕ as part of my journey through The Odin Project