mirror of
https://github.com/zhigang1992/actions.git
synced 2026-01-12 22:45:39 +08:00
28 lines
691 B
Bash
28 lines
691 B
Bash
#!/usr/bin/env bats
|
|
|
|
#load bootstrap
|
|
|
|
PATH="$PATH:$BATS_TEST_DIRNAME/../bin"
|
|
|
|
export GITHUB_EVENT_PATH="$BATS_TEST_DIRNAME/fixtures/deployment.json"
|
|
|
|
@test "returns deployment id and $? = 0 deployment event" {
|
|
run deployment-get-id
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" = "87972451" ]
|
|
}
|
|
|
|
@test "returns error code when GITHUB_EVENT_PATH not set" {
|
|
skip "this probably does not have the right behaviour?"
|
|
unset GITHUB_EVENT_PATH
|
|
run deployment-get-id
|
|
[ "$status" -ne 0 ]
|
|
}
|
|
|
|
@test "returns error code on other event than deployment" {
|
|
export GITHUB_EVENT_PATH="$BATS_TEST_DIRNAME/fixtures/pull_request_event.json"
|
|
run deployment-get-id
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" = "" ]
|
|
}
|