test: assert list cmd marks selected version

This commit is contained in:
jthegedus 2022-06-21 22:47:06 +10:00
parent 64ea460f64
commit 90e5f62f71

View File

@ -6,6 +6,9 @@ setup() {
setup_asdf_dir setup_asdf_dir
install_dummy_plugin install_dummy_plugin
install_dummy_broken_plugin install_dummy_broken_plugin
PROJECT_DIR=$HOME/project
mkdir $PROJECT_DIR
} }
teardown() { teardown() {
@ -21,6 +24,18 @@ teardown() {
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
} }
@test "list_command should list plugins with installed versions and any selected versions marked with asterisk" {
cd $PROJECT_DIR
echo 'dummy 1.1.0' >>$PROJECT_DIR/.tool-versions
run asdf install dummy 1.0.0
run asdf install dummy 1.1.0
run asdf list
[[ "$output" == *"$(echo -e "dummy\n 1.0.0\n *1.1.0")"* ]]
[[ "$output" == *"$(echo -e "dummy-broken\n No versions installed")"* ]]
[ "$status" -eq 0 ]
}
@test "list_command should continue listing even when no version is installed for any of the plugins" { @test "list_command should continue listing even when no version is installed for any of the plugins" {
run install_mock_plugin "dummy" run install_mock_plugin "dummy"
run install_mock_plugin "mummy" run install_mock_plugin "mummy"