-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (Dockerfile): add BATS testing framework and test directory to cont…
…ainer 🔧 (Dockerfile): set entrypoint to run BATS tests 📝 (README.md): update instructions for running tests and using autocomplete ⬆️ (autocomplete.sh): bump version from 0.3.4 to 0.3.5 ✨ (autocomplete.sh): add support for multiple API keys and providers ✨ (autocomplete.sh): enhance model_command to accept provider and model name 🔧 (docs/install.sh): allow specifying branch or version for installation ✅ (tests/test_autocomplete.bats): add comprehensive BATS tests for autocomplete.sh
- Loading branch information
1 parent
149c4ce
commit f3c09e8
Showing
5 changed files
with
121 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,56 @@ | ||
# tests/test_autocomplete.bats | ||
#!/usr/bin/env bats | ||
|
||
@test "Autocomplete script runs without errors" { | ||
run ./autocomplete.sh | ||
[ "$status" -eq 0 ] | ||
# Set a per-test timeout of 10 seconds | ||
export BATS_TEST_TIMEOUT=10 | ||
|
||
setup() { | ||
# Install autocomplete.sh and run testing against the main branch | ||
wget -qO- https://autocomplete.sh/install.sh | bash -s -- main | ||
|
||
# Source bashrc to make sure autocomplete is available in the current session | ||
source ~/.bashrc | ||
} | ||
|
||
teardown() { | ||
# Remove autocomplete.sh installation | ||
autocomplete remove | ||
} | ||
|
||
@test "which autocomplete returns something" { | ||
run which autocomplete | ||
[ "$status" -eq 0 ] | ||
[ -n "$output" ] | ||
} | ||
|
||
@test "autocomplete returns a string containing autocomplete.sh (case insensitive)" { | ||
run autocomplete | ||
[ "$status" -eq 0 ] | ||
[[ "$output" =~ [Aa]utocomplete\.sh ]] | ||
} | ||
|
||
@test "autocomplete config should not have the word DISABLED" { | ||
run autocomplete config | ||
[ "$status" -eq 0 ] | ||
[[ ! "$output" =~ DISABLED ]] | ||
} | ||
|
||
@test "autocomplete model gpt4o-mini and then config should have the string gpt4o-mini" { | ||
run autocomplete model openai gpt-4o-mini | ||
[ "$status" -eq 0 ] | ||
|
||
run autocomplete config | ||
[ "$status" -eq 0 ] | ||
[[ "$output" =~ gpt4o-mini ]] | ||
} | ||
|
||
@test "autocomplete command 'ls # show largest files' should return something" { | ||
run autocomplete command "ls # show largest files" | ||
[ "$status" -eq 0 ] | ||
[ -n "$output" ] | ||
} | ||
|
||
@test "autocomplete config sets environment variables" { | ||
run env | grep ACSH | wc -l | ||
[ "$status" -eq 0 ] | ||
[ "$output" -gt 1 ] | ||
} |