Skip to content

Commit 2f963ef

Browse files
Update Tests
1 parent 7d827c4 commit 2f963ef

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tests/git-auto-commit.bats

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ cat_github_output() {
799799
refute [assert_equal $current_sha $remote_sha]
800800
}
801801

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

@@ -819,7 +819,7 @@ cat_github_output() {
819819

820820
INPUT_BRANCH="new-branch"
821821

822-
# Assert that local remote does not know have "new-branch" locally nor does
822+
# Assert that local remote does not have a "new-branch"-branch nor does
823823
# know about the remote branch.
824824
run git branch
825825
refute_line --partial "new-branch"
@@ -831,16 +831,13 @@ cat_github_output() {
831831

832832
run git_auto_commit
833833

834-
assert_success
834+
assert_failure
835835

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

839-
# Assert that branch "new-branch" was updated on remote
840-
current_sha="$(git rev-parse --verify --short new-branch)"
841-
remote_sha="$(git rev-parse --verify --short origin/new-branch)"
842-
843-
assert_equal $current_sha $remote_sha
839+
assert_line --partial "Updates were rejected because the remote contains work that you do"
840+
assert_line --partial "not have locally. This is usually caused by another repository pushing"
844841
}
845842

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

0 commit comments

Comments
 (0)