dotfiles/.config/shell/rc.d/test/env-wiki-root.bats
Marty Oehme b11343b73a Add bats unit testing to repository
Will recursively look for `*.bats` files and run them with bats-core test suite. Simple sample unit tests for existing scripts are included in `.config/shell/rc.d/test`.
2019-07-27 11:42:54 +00:00

23 lines
454 B
Bash

setup() {
testfile="$BATS_TEST_DIRNAME/../env-wiki-root.sh"
}
teardown() {
export WIKIROOT=""
}
@test "Populates WIKIROOT environment variable" {
source $testfile
[ -n "$WIKIROOT" ]
}
@test "Sets WIKIROOT to correct default path" {
source $testfile
[ "$WIKIROOT" = "$HOME/Nextcloud/Notes/" ]
}
@test "Leaves WIKIROOT as is if it is already set" {
export WIKIROOT="MY/CUSTOM/DIR"
source $testfile
[ "$WIKIROOT" = "MY/CUSTOM/DIR" ]
}