asdf

Форк
0
/
plugin_list_all_command.bats 
76 строк · 2.4 Кб
1
#!/usr/bin/env bats
2
# shellcheck disable=SC2030,SC2031
3

4
load test_helpers
5

6
setup() {
7
  setup_asdf_dir
8
  setup_repo
9
  install_dummy_plugin
10
}
11

12
teardown() {
13
  clean_asdf_dir
14
}
15

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"
20

21
  run asdf plugin list all
22
  [ "$status" -eq 1 ]
23
  [ "$output" = "$expected" ]
24
}
25

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"
34

35
  run asdf plugin list all
36
  [ "$status" -eq 0 ]
37
  [[ "$output" == *"$expected_plugin_repo_sync"* ]]
38
  [[ "$output" == *"$expected_plugins_list"* ]]
39
}
40

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"
44
  local expected="\
45
bar                           http://example.com/bar
46
dummy                        *http://example.com/dummy
47
foo                           http://example.com/foo"
48

49
  run asdf plugin list all
50
  [ "$status" -eq 0 ]
51
  [ "$output" = "$expected" ]
52
}
53

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"
57
  local expected="\
58
bar                           http://example.com/bar
59
dummy                        *http://example.com/dummy
60
foo                           http://example.com/foo"
61

62
  run asdf plugin list all
63
  [ "$status" -eq 0 ]
64
  [ "$output" = "$expected" ]
65
}
66

67
@test "plugin_list_all list all plugins in the repository" {
68
  local expected="\
69
bar                           http://example.com/bar
70
dummy                        *http://example.com/dummy
71
foo                           http://example.com/foo"
72

73
  run asdf plugin list all
74
  [ "$status" -eq 0 ]
75
  [ "$output" = "$expected" ]
76
}
77

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.