Skip to content

Commit

Permalink
Add Testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanzweifel committed Feb 7, 2021
1 parent 520c63c commit 8056699
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/git-auto-commit.bats
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,25 @@ git_auto_commit() {

assert_line "::debug::git-fetch has not been executed"
}

@test "If INPUT_BRANCH is set and the branch does not exist it creates one" {
INPUT_BRANCH="new-branch"

run git branch
refute_line "new-branch"

touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt

run git_auto_commit

assert_success

assert_line "INPUT_BRANCH value: new-branch"
assert_line --partial "::debug::Push commit to remote branch new-branch"

# Assert that branch "new-branch" was updated on remote
current_sha="$(git rev-parse --verify --short new-branch)"
remote_sha="$(git rev-parse --verify --short origin/new-branch)"

assert_equal $current_sha $remote_sha
}

0 comments on commit 8056699

Please sign in to comment.