Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanzweifel committed Dec 19, 2023
1 parent 80052f0 commit 9062db8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/git-auto-commit.bats
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ cat_github_output() {
refute [assert_equal $current_sha $remote_sha]
}

@test "It pushes commit to remote if branch already exists and local repo is behind its remote counterpart" {
@test "It fails to push commit to remote if branch already exists and local repo is behind its remote counterpart" {
# Create `new-branch` on remote with changes the local repository does not yet have
cd $FAKE_TEMP_LOCAL_REPOSITORY

Expand All @@ -816,7 +816,7 @@ cat_github_output() {

INPUT_BRANCH="new-branch"

# Assert that local remote does not know have "new-branch" locally nor does
# Assert that local remote does not have a "new-branch"-branch nor does
# know about the remote branch.
run git branch
refute_line --partial "new-branch"
Expand All @@ -828,16 +828,13 @@ cat_github_output() {

run git_auto_commit

assert_success
assert_failure

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
assert_line --partial "Updates were rejected because the remote contains work that you do"
assert_line --partial "not have locally. This is usually caused by another repository pushing"
}

@test "throws fatal error if file pattern includes files that do not exist" {
Expand Down

0 comments on commit 9062db8

Please sign in to comment.