diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/tests/ai-launcher-runtime.bats | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/scripts/tests/ai-launcher-runtime.bats b/scripts/tests/ai-launcher-runtime.bats index b93f778..3f0ad69 100644 --- a/scripts/tests/ai-launcher-runtime.bats +++ b/scripts/tests/ai-launcher-runtime.bats @@ -11,10 +11,11 @@ setup() { PROJ="$(mktemp -d)" mkdir -p "$PROJ/.ai" touch "$PROJ/.ai/protocols.org" + STUB_BIN="$(mktemp -d)" } teardown() { - rm -rf "$PROJ" + rm -rf "$PROJ" "$STUB_BIN" } @test "default runtime launches claude" { @@ -63,3 +64,34 @@ teardown() { [ "$status" -eq 1 ] [[ "$output" == *"protocols.org"* ]] } + +@test "--print-runtimes lists claude, codex, and one line per ollama model" { + cat > "$STUB_BIN/ollama" <<'STUB' +#!/bin/bash +if [ "$1" = "list" ]; then + printf 'NAME ID SIZE MODIFIED\n' + printf 'gpt-oss:120b aaa 65 GB 1 hour ago\n' + printf 'qwen3-coder:30b bbb 18 GB 1 hour ago\n' +fi +STUB + chmod +x "$STUB_BIN/ollama" + PATH="$STUB_BIN:$PATH" run bash "$AI" --print-runtimes + [ "$status" -eq 0 ] + [ "${lines[0]%% *}" = "claude" ] + [[ "$output" == *"codex"* ]] + [[ "$output" == *"local:gpt-oss:120b"* ]] + [[ "$output" == *"local:qwen3-coder:30b"* ]] +} + +@test "a dead ollama server just drops the local lines" { + cat > "$STUB_BIN/ollama" <<'STUB' +#!/bin/bash +echo "Error: could not connect to a running Ollama instance" >&2 +exit 1 +STUB + chmod +x "$STUB_BIN/ollama" + PATH="$STUB_BIN:$PATH" run bash "$AI" --print-runtimes + [ "$status" -eq 0 ] + [[ "$output" == *"claude"* ]] + [[ "$output" != *"local:"* ]] +} |
