Skip to content

Commit

Permalink
test: add feature tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edouard-lopez committed Feb 16, 2024
1 parent d8c4b74 commit 7f713ca
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/_pure_prompt.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source (status dirname)/../functions/_pure_prompt.fish
source (status dirname)/../functions/_pure_prompt_jobs.fish
source (status dirname)/../functions/_pure_prompt_nixdevshell.fish
source (status dirname)/../functions/_pure_prompt_virtualenv.fish
source (status dirname)/../functions/_pure_prompt_aws_profile.fish
source (status dirname)/../functions/_pure_prompt_vimode.fish
source (status dirname)/../functions/_pure_prompt_symbol.fish
source (status dirname)/../functions/_pure_get_prompt_symbol.fish
Expand Down
56 changes: 56 additions & 0 deletions tests/_pure_prompt_aws_profile.test.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
source (status dirname)/fixtures/constants.fish
source (status dirname)/../functions/_pure_set_default.fish
source (status dirname)/../functions/_pure_prompt_aws_profile.fish
@echo (_print_filename (status filename))

function before_each
_purge_configs
_disable_colors # we use mocks so cleaning them must happen before

set --erase AWS_PROFILE
set --erase AWS_VAULT
end

before_each
@test "_pure_prompt_aws_profile: ensure default behaviour has no error" (
source (status dirname)/../conf.d/pure.fish

_pure_prompt_aws_profile
) $status -eq $SUCCESS


before_each
@test "_pure_prompt_aws_profile: ensure default behaviour print nothing when no AWS variables" (
source (status dirname)/../conf.d/pure.fish

echo (_pure_prompt_aws_profile)
) = $EMPTY

before_each
@test "_pure_prompt_aws_profile: print AWS_VAULT when present" (
set --universal pure_enable_aws_profile true
set --universal pure_symbol_aws_profile_prefix "🅰"
set --global AWS_VAULT my-vault

_pure_prompt_aws_profile
) = '🅰my-vault'

before_each
@test "_pure_prompt_aws_profile: print AWS_PROFILE when present" (
set --universal pure_enable_aws_profile true
set --universal pure_symbol_aws_profile_prefix "🅰"
set --global AWS_PROFILE my-profile

_pure_prompt_aws_profile
) = '🅰my-profile'


before_each
@test "_pure_prompt_aws_profile: print only AWS_VAULT when vault and profile are present" (
set --universal pure_enable_aws_profile true
set --universal pure_symbol_aws_profile_prefix "🅰"
set --global AWS_VAULT my-vault
set --global AWS_PROFILE my-profile

_pure_prompt_aws_profile
) = '🅰my-vault'

0 comments on commit 7f713ca

Please sign in to comment.