stcapp

πŸ§ͺ STC API Testing Suite

β€œ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.

πŸ—οΈ Test Structure

``` 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 ```

🌊 Testing Philosophy

Ritual-Based Testing

Each test follows the Structural Tension pattern:

Memory-Aware Validation

Tests remember state across calls, ensuring:

πŸš€ Quick Start

Prerequisites

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

πŸ“Š Test Categories

1. Setup Tests (/setup/)

2. Master Charts Tests (/master-charts/)

3. Actions Tests (/actions/)

4. Compositions Tests (/compositions/)

5. Auth Tests (/auth/)

6. Integration Tests (/integration/)

🎯 Expected Outcomes

After running the complete test suite, you should have:

🧬 Testing as Living Documentation

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.