Files
Jane Alesi e6e5f34455 feat: add android-fs5 CLI toolset
- fs5 entrypoint with status, push, pull, app, shell, logs commands
- lib/adb.sh: ADB wrapper functions with idempotency and --force guards
- lib/output.sh: human + JSON output formatting via Python
- 33 bats tests (6 status, 9 transfer, 7 app, 5 shell, 6 logs) — all passing
- Zero shellcheck warnings
- .env-based config (device serial, log path)
- Spec-Driven Development artifacts in specs/001-android-fs5-management/

Device: exone GmbH FS5 (RD51QE202392, Android 9)
2026-03-02 15:55:09 +01:00

58 lines
1.5 KiB
Bash

#!/usr/bin/env bats
# tests/test_app.bats — Tests for 'fs5 app' commands (US3)
bats_require_minimum_version 1.5.0
SCRIPT="${BATS_TEST_DIRNAME}/../fs5"
setup() {
export DEVICE_SERIAL="RD51QE202392"
export LOG_FILE="/tmp/fs5-test-$$.log"
}
teardown() {
rm -f "${LOG_FILE}"
}
@test "app list: exits with code 0" {
run "${SCRIPT}" app list
[ "${status}" -eq 0 ]
}
@test "app list: output contains package names" {
run "${SCRIPT}" app list
[ "${status}" -eq 0 ]
[[ "${output}" == *"package:"* ]] || [[ "${output}" == *"com."* ]]
}
@test "app list --all: includes system packages" {
run "${SCRIPT}" app list --all
[ "${status}" -eq 0 ]
# Android system packages always present
[[ "${output}" == *"android"* ]]
}
@test "app list: --json produces valid JSON array" {
run "${SCRIPT}" app list --json
[ "${status}" -eq 0 ]
echo "${output}" | python3 -c "import json,sys; d=json.load(sys.stdin); assert isinstance(d, list)"
}
@test "app install: fails with exit code 1 when APK not found" {
run "${SCRIPT}" app install /nonexistent/app.apk
[ "${status}" -eq 1 ]
[[ "${output}" == *"not found"* ]]
}
@test "app uninstall: requires --force flag" {
run "${SCRIPT}" app uninstall com.example.nonexistent
[ "${status}" -eq 1 ]
[[ "${output}" == *"--force"* ]]
}
@test "app uninstall: exits gracefully when package not installed" {
run "${SCRIPT}" app uninstall com.example.nonexistent.xyz --force
# Should exit 1 (not found) but not crash
[ "${status}" -ne 2 ]
}