Add unit tests for managing latest stable versions

This commit is contained in:
Kevin Lane 2019-11-22 10:37:53 -08:00
parent 62ef77670d
commit c11409583f
No known key found for this signature in database
GPG Key ID: 1C86152D9F2E3D7F
3 changed files with 48 additions and 0 deletions

View File

@ -188,3 +188,15 @@ EOM
[ "$output" == "" ]
[ -f $ASDF_DIR/installs/dummy/1.2/version ]
}
@test "install_command latest installs latest stable version" {
run asdf install dummy latest
[ "$status" -eq 0 ]
[ $(cat $ASDF_DIR/installs/dummy/2.0/version) = "2.0" ]
}
@test "install_command latest:version installs latest stable version that matches the given string" {
run asdf install dummy latest:1
[ "$status" -eq 0 ]
[ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ]
}

24
test/latest_command.bats Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bats
load test_helpers
setup() {
setup_asdf_dir
install_dummy_plugin
}
teardown() {
clean_asdf_dir
}
@test "latest_command shows latest stable version" {
run asdf latest dummy
[ "$(echo -e "2.0")" == "$output" ]
[ "$status" -eq 0 ]
}
@test "latest_command with version shows latest stable version that matches the given string" {
run asdf latest dummy 1
[ "$(echo -e "1.1")" == "$output" ]
[ "$status" -eq 0 ]
}

View File

@ -37,3 +37,15 @@ teardown() {
[ "$(echo -e " 1.0\n 1.1")" == "$output" ]
[ "$status" -eq 0 ]
}
@test "list_all_command lists available versions" {
run asdf list-all dummy
[ "$(echo -e "1.0\n1.1\n2.0")" == "$output" ]
[ "$status" -eq 0 ]
}
@test "list_all_command with version filters available versions" {
run asdf list-all dummy 1
[ "$(echo -e "1.0\n1.1")" == "$output" ]
[ "$status" -eq 0 ]
}