Skip to content

Commit

Permalink
✅ test: add tests for plugin update
Browse files Browse the repository at this point in the history
  • Loading branch information
gazorby committed Jan 23, 2023
1 parent 2fd7e50 commit aadfd86
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/common.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
function setup
# Source plugin
source functions/__abbr_tips_init.fish
source functions/__abbr_tips_clean.fish
source conf.d/abbr_tips.fish
source functions/__abbr_tips_bind_newline.fish
source functions/__abbr_tips_bind_space.fish
Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions tests/test_plugin_update.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
source (string join "/" (dirname (status --current-filename)) "common.fish")

# Test that plugin update reset tip keys

setup

@test "plugin update __ABBR_TIPS_KEYS length" (
set len_keys (count $__ABBR_TIPS_KEYS)
set -a __ABBR_TIPS_KEYS __wrong_key
__abbr_tips_update
test (count $__ABBR_TIPS_KEYS) -eq $len_keys
) "$status" = 0

setup

@test "plugin update __ABBR_TIPS_KEYS value" (
set last_key "$__ABBR_TIPS_KEYS[-1]"
set -a __ABBR_TIPS_KEYS __wrong_key
__abbr_tips_update
test "$__ABBR_TIPS_KEYS[-1]" = "$last_key"
) "$status" = 0

setup

# Test that plugin update reset tip values

@test "plugin update __ABBR_TIPS_VALUES length" (
set len_keys (count $__ABBR_TIPS_VALUES)
set -a __ABBR_TIPS_VALUES __wrong_key
__abbr_tips_update
test (count $__ABBR_TIPS_VALUES) -eq $len_keys
) "$status" = 0

setup

@test "plugin update __ABBR_TIPS_VALUES value" (
set last_key "$__ABBR_TIPS_VALUES[-1]"
set -a __ABBR_TIPS_VALUES __wrong_key
__abbr_tips_update
test "$__ABBR_TIPS_VALUES[-1]" = "$last_key"
) "$status" = 0


teardown

0 comments on commit aadfd86

Please sign in to comment.