Skip to content

Commit

Permalink
Add basic tests for legacy plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratus3D committed May 4, 2020
1 parent a886303 commit 5c6f24f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/install_command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load test_helpers

setup() {
setup_asdf_dir
install_dummy_legacy_plugin
install_dummy_plugin

PROJECT_DIR=$HOME/project
Expand All @@ -20,6 +21,12 @@ teardown() {
[ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ]
}

@test "install_command installs the correct version for plugins without download script" {
run asdf install legacy-dummy 1.1
[ "$status" -eq 0 ]
[ $(cat $ASDF_DIR/installs/legacy-dummy/1.1/version) = "1.1" ]
}

@test "install_command without arguments installs even if the user is terrible and does not use newlines" {
cd $PROJECT_DIR
echo -n 'dummy 1.2' > ".tool-versions"
Expand Down Expand Up @@ -56,6 +63,14 @@ teardown() {
[ "$status" -eq 0 ]
}

@test "install_command should create a shim with asdf-plugin metadata for plugins without download script" {
run asdf install legacy-dummy 1.0
[ "$status" -eq 0 ]
[ -f $ASDF_DIR/installs/legacy-dummy/1.0/env ]
run grep "asdf-plugin: legacy-dummy 1.0" $ASDF_DIR/shims/dummy
[ "$status" -eq 0 ]
}

@test "install_command on two versions should create a shim with asdf-plugin metadata" {
run asdf install dummy 1.1
[ "$status" -eq 0 ]
Expand Down

0 comments on commit 5c6f24f

Please sign in to comment.