From 9062db84044052e24f7da048fb8ea63c51eda180 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 19 Dec 2023 21:00:32 +0100 Subject: [PATCH] Update Tests --- tests/git-auto-commit.bats | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/git-auto-commit.bats b/tests/git-auto-commit.bats index 5666c96..3d5c558 100644 --- a/tests/git-auto-commit.bats +++ b/tests/git-auto-commit.bats @@ -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 @@ -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" @@ -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" {