# WannaBuild Test Suite
Real, executable tests for the shell scripts and contract validation in
`scripts/`. Tests are written in [Bats](https://github.com/bats-core/bats-core)
(Bash Automated Testing System) and run hermetically in temp directories — no
test reads or writes outside its `$BATS_TEST_TMPDIR` or `tests/results/`.
## Quick start
```bash
# Run everything (parallelized, 4 jobs by default)
bash tests/run.sh
# Run only unit tests
bash tests/run.sh --unit
# Run only integration tests
bash tests/run.sh --integration
# Or use the Makefile
make -C tests test
make -C tests unit
make -C tests integration
make -C tests coverage
make -C tests clean
```
If `bats` is not on your `PATH`, `tests/run.sh` will clone `bats-core` into
`tests/.bats/` for the duration of the run. Nothing is installed system-wide.
The companion libraries `bats-support`, `bats-assert`, and `bats-file` are
also fetched into `tests/.bats-libs/` so individual tests may opt in via
`load`. None are required by the existing test files.
## Layout
```text
tests/
├── README.md ← you are here
├── Makefile ← convenience targets
├── bats.conf ← default options (BATS_JOBS, output dir, …)
├── run.sh ← entry point
├── coverage.sh ← kcov-based coverage with configurable threshold
├── test_helper.bash ← shared helpers (loaded by every .bats file)
├── fixtures/ ← minimal-valid JSON fixtures used by helpers/tests
│ ├── state-requirements.json
│ ├── state-design.json
│ ├── state-tasks.json
│ ├── state-implement.json
│ ├── state-invalid-missing-id.json
│ ├── loop-state-pass.json
│ ├── loop-state-fail.json
│ ├── review-verdict-valid.json
│ └── checkpoint-valid.json
├── unit/ ← per-script behavioral tests
│ ├── test_validate_artifacts_cli.bats
│ ├── test_doctor_script.bats
│ ├── test_gate_check.bats
│ ├── test_workspace_bootstrap.bats
│ └── test_session_script.bats
├── integration/ ← multi-script flows
│ ├── test_phase_transition_flow.bats
│ ├── test_doctor_full_repo.bats
│ └── test_artifact_schema_conformance.bats
└── results/ ← junit.xml & friends are written here
```
## Naming conventions
* **Files**: `test_.bats` under either `tests/unit/` (one script,
isolated behavior) or `tests/integration/` (more than one script or
multi-file flows).
* **`@test` names**: `"