Testing Strategy
ShopStack Platform uses a comprehensive testing approach across both services:- Python Service: pytest-based test suite with fixtures and database isolation
- Node.js Service: Jest-based test suite with Sequelize ORM integration
- Integration Testing: Full API endpoint coverage with authenticated requests
- Security Testing: SQL injection prevention and input validation tests
Test Structure
Python Service Tests
Located inpython-service/tests/:
Node.js Service Tests
Located innode-service/tests/:
Running All Tests
Use the provided test runner script to execute all tests across both services:Test Coverage Areas
Authentication & Authorization
- User registration with validation
- Login with JWT token generation
- Email validation (including plus addressing)
- Password verification
- Duplicate email prevention
Product Management
- Product listing with pagination
- Category filtering
- Search functionality
- Product creation (authenticated)
- Stock management
Order Processing
- Order creation with multiple items
- Stock validation
- Discount code application
- Order status tracking
- Order item associations
Payment Processing
- Tax calculation (8.5% rate)
- Discount code validation
- Total computation
- Checkout flow
- Payment status updates
Security
- SQL injection prevention
- Input sanitization
- Authentication requirements
- Authorization checks
Test Output
Both test suites provide verbose output with:- Test names and descriptions
- Pass/fail status for each test
- Detailed error messages and stack traces
- Test execution time
- Coverage summary
Next Steps
Python Tests
Detailed Python test suite documentation
Node.js Tests
Detailed Node.js test suite documentation