Files
football/tests/unit/run_test.bats
T
mrcharles c1d8c5def6 chore: clean up root directory and consolidate documentation
Remove obsolete documentation files and consolidate into docs/ directory. Remove redundant test scripts (functionality will be folded into run.sh). Update AGENTS.md with SDLC workflow. Update PRD.md with tier0 architecture clarification. Update README.md to reflect clean directory structure.

Changes:
- Delete: BUILD-COMPLETE.md, BUILD-SUMMARY.md, RESUME.md, SESSION-CLOSED.md
- Delete: FINAL-SECURITY-COMPLIANCE-REPORT.md, QUICK_START.md, JOURNAL.md
- Move: TEST-COVERAGE.md, VERIFICATION-REPORT.md to docs/
- Delete: test-iso.sh, test-runner.sh (will fold into run.sh)
- Update: AGENTS.md with SDLC workflow section
- Update: PRD.md with tier0 architecture clarification and diagram
- Update: README.md to reflect clean directory structure

Root directory now contains only: AGENTS.md, README.md, PRD.md, Dockerfile, run.sh

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-01-29 12:07:28 -05:00

72 lines
1.8 KiB
Bash

#!/usr/bin/env bats
# Unit tests for run.sh main entry point
# Add bats library to BATS_LIB_PATH
load 'bats-support/load'
load 'bats-assert/load'
load '../test_helper/common.bash'
# Setup test environment
setup() {
# Source the main script
export SCRIPT_DIR="${PROJECT_ROOT}"
export DOCKER_IMAGE="knel-football-dev:latest"
export OUTPUT_DIR="${TEST_TEMP_DIR}/output"
export BUILD_DIR="${TEST_TEMP_DIR}/build"
mkdir -p "${OUTPUT_DIR}" "${BUILD_DIR}"
# Mock docker command
docker() {
echo "docker $@"
}
export -f docker
}
@test "run.sh exists and is executable" {
assert_file_exists "${PROJECT_ROOT}/run.sh"
assert [ -x "${PROJECT_ROOT}/run.sh" ]
}
@test "run.sh shows usage with help command" {
run bash "${PROJECT_ROOT}/run.sh" help
assert_success
assert_line --partial "Usage:"
assert_line --partial "build"
assert_line --partial "test"
assert_line --partial "iso"
}
@test "run.sh creates output and build directories" {
rm -rf "${OUTPUT_DIR}" "${BUILD_DIR}"
run bash "${PROJECT_ROOT}/run.sh" build
assert [ -d "${OUTPUT_DIR}" ]
assert [ -d "${BUILD_DIR}" ]
}
@test "run.sh test command runs bats tests" {
skip "Requires full Docker environment - run with ./run.sh test"
}
@test "run.sh lint command runs shellcheck" {
skip "Requires full Docker environment - run with ./run.sh lint"
}
@test "run.sh clean command removes artifacts" {
# Create test artifacts
touch "${OUTPUT_DIR}/test.iso"
touch "${BUILD_DIR}/test.log"
run bash "${PROJECT_ROOT}/run.sh" clean
assert_success
refute_file_exists "${OUTPUT_DIR}/test.iso"
refute_file_exists "${BUILD_DIR}/test.log"
}
@test "run.sh test:iso command delegates to test-iso.sh" {
assert_file_exists "${PROJECT_ROOT}/test-iso.sh"
assert [ -x "${PROJECT_ROOT}/test-iso.sh" ]
}