Description
Create a test suite for Nerva's 9 automation scripts using a bash testing framework like BATS (Bash Automated Testing System). The scripts are production tooling — they deserve the same testing rigor as the APIs they generate.
Why
The scripts are the primary interface for users interacting with Nerva. A bug in `setup-project.sh` could generate broken projects. Currently, CI validates syntax (`bash -n`) but doesn't test behavior. Script tests catch regressions when contributors modify the scripts.
Acceptance Criteria
Implementation Notes
Using BATS:
```bash
tests/scripts/setup-project.bats
@test "setup-project creates correct directory structure" {
run ./scripts/setup-project.sh test-project --node --dry-run
[ "$status" -eq 0 ]
[[ "$output" == "api/src/routes" ]]
}
@test "setup-project rejects missing project name" {
run ./scripts/setup-project.sh
[ "$status" -eq 1 ]
[[ "$output" == "Missing project name" ]]
}
```
Depends on #8 (`--dry-run` flag) for safe testing without side effects.
Description
Create a test suite for Nerva's 9 automation scripts using a bash testing framework like BATS (Bash Automated Testing System). The scripts are production tooling — they deserve the same testing rigor as the APIs they generate.
Why
The scripts are the primary interface for users interacting with Nerva. A bug in `setup-project.sh` could generate broken projects. Currently, CI validates syntax (`bash -n`) but doesn't test behavior. Script tests catch regressions when contributors modify the scripts.
Acceptance Criteria
Implementation Notes
Using BATS:
```bash
tests/scripts/setup-project.bats
@test "setup-project creates correct directory structure" {
run ./scripts/setup-project.sh test-project --node --dry-run
[ "$status" -eq 0 ]
[[ "$output" == "api/src/routes" ]]
}
@test "setup-project rejects missing project name" {
run ./scripts/setup-project.sh
[ "$status" -eq 1 ]
[[ "$output" == "Missing project name" ]]
}
```
Depends on #8 (`--dry-run` flag) for safe testing without side effects.