Replies: 1 comment
-
|
My approach for situations like this: I'm not the What I really want to test is if my code calls #!/usr/bin/env bats
@test "my_function calls apt correctly" {
# Create a function with the same name of the external tool to mock its behavior
apt() {
if [[ $* == 'install php8.2' ]]; then
echo "mocked output"
else
return 1
fi
}
export -f apt
run my_function
assert_output --partial "mocked output"
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Totally new to bats-core
apt install php8.2?apt install php8.2actually runs?Beta Was this translation helpful? Give feedback.
All reactions