mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2025-12-11 22:02:32 +01:00
Improve tests by making use of local variables
This commit is contained in:
parent
822b820a6e
commit
4972f0b8eb
8 changed files with 207 additions and 281 deletions
|
|
@ -66,32 +66,31 @@ function mockKubectlOtherNamespace() {
|
|||
}
|
||||
|
||||
function testKubeContext() {
|
||||
alias kubectl=mockKubectl
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
||||
alias kubectl=mockKubectl
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/default %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
|
||||
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
unalias kubectl
|
||||
}
|
||||
function testKubeContextOtherNamespace() {
|
||||
alias kubectl=mockKubectlOtherNamespace
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
||||
alias kubectl=mockKubectlOtherNamespace
|
||||
|
||||
assertEquals "%K{magenta} %F{white%}⎈ %f%F{white}minikube/kube-system %k%F{magenta}%f " "$(build_left_prompt)"
|
||||
|
||||
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
unalias kubectl
|
||||
}
|
||||
function testKubeContextPrintsNothingIfKubectlNotAvailable() {
|
||||
alias kubectl=noKubectl
|
||||
POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world kubecontext)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
alias kubectl=noKubectl
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
unset POWERLEVEL9K_CUSTOM_WORLD
|
||||
unalias kubectl
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue