βEvery endpoint is a threshold, every test a ritual of validation.β
This testing suite provides comprehensive validation for all STC (Structural Tension Chart) API endpoints. Each test category mirrors the applicationβs architectural patterns and ensures the complete API ecosystem functions as intended.
```
tests/
βββ README.md # This guide
βββ run-all-tests.sh # Master test runner
βββ setup/ # Database & initialization tests
βββ master-charts/ # Chart CRUD operation tests
βββ actions/ # Action management tests
βββ compositions/ # Musical composition tests
βββ auth/ # Authentication tests
βββ integration/ # Full workflow tests
βββ utils/ # Testing utilities
```
Each test follows the Structural Tension pattern:
Tests remember state across calls, ensuring:
The test suite relies on a running PostgreSQL instance. Set the DATABASE_URL
environment variable to point to your database before launching the server.
export DATABASE_URL=postgres://user:pass@localhost:5432/stcapp_test
# Install dependencies if needed
pnpm install
# Easiest: start the server and run all tests automatically
./scripts/run-tests-with-server.sh
# Manual approach (in separate terminals)
npm run dev # start the dev server
./tests/run-all-tests.sh
# Run specific test category
./tests/setup/test-setup.sh
./tests/master-charts/test-master-charts.sh
./tests/actions/test-actions.sh
/setup/)/master-charts/)/actions/)/compositions/)/auth/)/integration/)After running the complete test suite, you should have:
These tests serve as both validation and specification. Each curl command demonstrates:
The tests become a living API reference that stays current with the codebase.