Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xmas 2022 updates #55

Merged
Prev Previous commit
Next Next commit
cleanup - pt1
  • Loading branch information
Frank Peng committed Dec 28, 2022
commit 0eb5e9ba56dd37ce93cd0de566dc1b422360f973
41 changes: 9 additions & 32 deletions tests/test-plugin/tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,19 @@ load "$BATS_PLUGIN_PATH/load.bash"

# export FOO_STUB_DEBUG=/dev/tty

@test "bats works AOK" {
run bash -c "echo 'AOK'"
@test "bats-core/bats works AOK" {
run echo 'AOK'
assert_success
}

@test "bats-mock works" {
stub foo \
"bar : echo baz"
run foo bar
assert_success
unstub foo
@test "Intentional Failure - Not AOK" {
run bash -c "echo 'Not AOK!'; exit 1"
assert_failure
}

# # @test 'assert_success() status only' {
# # run bash -c "echo 'Error!'; exit 1"
# # assert_success
# # }

# # @test 'assert_failure() status only' {
# # run echo 'Success!'
# # assert_failure
# # }

# @test 'assert success' {
# run bash -c "echo 'this'"
# assert_success
# }

@test "echoing" {
run echo "AOK"
assert_success
}

@test "stubbing" {
stub greet "sayhi: echo hello"
run greet sayhi
@test "buildkite-plugins/bats-mock works" {
stub foo "bar : echo baz"
run foo bar
assert_success
unstub greet
unstub foo
}