docs: add development database and testing documentation

This commit is contained in:
2026-03-31 16:53:42 -07:00
parent 26c5158724
commit b5af4b2e34
3 changed files with 106 additions and 0 deletions
+40
View File
@@ -161,6 +161,46 @@ DATABASE_URL="postgresql://username:password@localhost:5432/euchre_camp"
DATABASE_SHADOW_URL="postgresql://username:password@localhost:5432/euchre_camp_shadow"
```
## Development Database
For development and testing, use a separate development database to avoid conflicts with production data.
**Setup Development Database:**
```bash
# Create and setup the development database
npm run db:setup-dev
# Reset the development database (drops and recreates)
npm run db:reset-dev
# Clean development database (drop and recreate with migrations)
npm run db:setup-dev:clean
```
**Environment Configuration:**
The development database uses `.env.development` which is automatically configured for:
- Database: `euchre_camp_dev`
- NODE_ENV: `development`
**Testing with Development Database:**
```bash
# Run unit tests (uses test database automatically)
npm run test
# Run acceptance tests (uses development database)
npm run test:acceptance
```
**Test Data Cleanup:**
All tests automatically clean up their created records:
- Global setup/teardown handles Playwright tests
- Test utilities provide `cleanupTestRecords()` for manual cleanup
- Tests use `beforeEach` and `afterEach` hooks for automatic cleanup
## Usage
### Creating a Tournament