diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-07-16 21:46:23 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-07-16 21:46:23 +0300 |
commit | 8c44fa68a25c12748fd4f031c691c54b76d0e290 (patch) | |
tree | fe250e24d8433b40daa02981a1447c4f2dfee98e /test/segments | |
parent | 0e4e9e4256b286213843f4e83a46c7ecb68a8bc1 (diff) |
Add tests for aws_eb_env segment
Diffstat (limited to 'test/segments')
-rwxr-xr-x | test/segments/aws_eb_env.spec | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/segments/aws_eb_env.spec b/test/segments/aws_eb_env.spec new file mode 100755 index 00000000..530da6a1 --- /dev/null +++ b/test/segments/aws_eb_env.spec @@ -0,0 +1,51 @@ +#!/usr/bin/env zsh +#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 + +# Required for shunit2 to run correctly +setopt shwordsplit +SHUNIT_PARENT=$0 + +function setUp() { + export TERM="xterm-256color" + # Load Powerlevel9k + source powerlevel9k.zsh-theme +} + +function testAwsEbEnvSegmentPrintsNothingIfNoElasticBeanstalkEnvironmentIsSet() { + local POWERLEVEL9K_CUSTOM_WORLD='echo world' + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env custom_world) + + assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" +} + +function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() { + mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk + echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml + cd /tmp/powerlevel9k-test + + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + + assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)" + + rm -fr /tmp/powerlevel9k-test + cd - +} + +function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirectory() { + # Skip test, because currently we cannot detect + # if the configuration is in a parent directory + startSkipping # Skip test + mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk + mkdir -p /tmp/powerlevel9k-test/1/12/123/1234/12345 + echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml + cd /tmp/powerlevel9k-test/1/12/123/1234/12345 + + local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + + assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)" + + rm -fr /tmp/powerlevel9k-test + cd - +} + +source shunit2/source/2.1/src/shunit2
\ No newline at end of file |