2
# shellcheck disable=SC2030,SC2031
16
@test "plugin_list_all should exit before syncing the plugin repo if disabled" {
17
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
18
echo 'disable_plugin_short_name_repository=yes' >"$ASDF_CONFIG_DEFAULT_FILE"
19
local expected="Short-name plugin repository is disabled"
21
run asdf plugin list all
23
[ "$output" = "$expected" ]
26
@test "plugin_list_all should sync repo when check_duration set to 0" {
27
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
28
echo 'plugin_repository_last_check_duration = 0' >"$ASDF_CONFIG_DEFAULT_FILE"
29
local expected_plugin_repo_sync="updating plugin repository..."
30
local expected_plugins_list="\
31
bar http://example.com/bar
32
dummy *http://example.com/dummy
33
foo http://example.com/foo"
35
run asdf plugin list all
37
[[ "$output" == *"$expected_plugin_repo_sync"* ]]
38
[[ "$output" == *"$expected_plugins_list"* ]]
41
@test "plugin_list_all no immediate repo sync expected because check_duration is greater than 0" {
42
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
43
echo 'plugin_repository_last_check_duration = 10' >"$ASDF_CONFIG_DEFAULT_FILE"
45
bar http://example.com/bar
46
dummy *http://example.com/dummy
47
foo http://example.com/foo"
49
run asdf plugin list all
51
[ "$output" = "$expected" ]
54
@test "plugin_list_all skips repo sync because check_duration is set to never" {
55
export ASDF_CONFIG_DEFAULT_FILE="$HOME/.asdfrc"
56
echo 'plugin_repository_last_check_duration = never' >"$ASDF_CONFIG_DEFAULT_FILE"
58
bar http://example.com/bar
59
dummy *http://example.com/dummy
60
foo http://example.com/foo"
62
run asdf plugin list all
64
[ "$output" = "$expected" ]
67
@test "plugin_list_all list all plugins in the repository" {
69
bar http://example.com/bar
70
dummy *http://example.com/dummy
71
foo http://example.com/foo"
73
run asdf plugin list all
75
[ "$output" = "$expected" ]