Add sample unit tests
Two should pass, one should fail
This commit is contained in:
parent
0318734dd6
commit
08e15dab3a
1 changed files with 23 additions and 0 deletions
23
.config/shell/rc.d/test/env-wiki-root.bats
Normal file
23
.config/shell/rc.d/test/env-wiki-root.bats
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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" ]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue