I'm have a custom orb, and for testing shell scripts I'm using bats orb.
I'm including helpers into my test like in their tutorial.
Here is my orb test job
- bats/run:
formatter: junit
path: ./src/tests
timing: true
And here is my src/tests/utils.bats
#!/usr/bin/env bats
setup() {
load "test_helper/bats-assert/load"
source "./src/scripts/utils.sh"
}
# 1 Should load file when
@test "1.1: config file given, required tag missing " {
mkdir -p "/home/circleci/"
touch "/home/circleci/.test.utils.config "
config_file="/home/circleci/.test.utils.config"
echo "NEW_PARAMETER=value" > $config_file
SourceParameters "${config_file}"
assert_equal "${NEW_PARAMETER}" "value" # Check for no exit error
}