From c5644d8407e7bd95da54f7321cff1c8f5033c70f Mon Sep 17 00:00:00 2001 From: Katajisto Date: Fri, 20 Sep 2024 09:36:33 +0300 Subject: [PATCH] fix: tests --- pkg/ui/conflict/conflict_test.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkg/ui/conflict/conflict_test.go b/pkg/ui/conflict/conflict_test.go index 2c901986..eb22df6f 100644 --- a/pkg/ui/conflict/conflict_test.go +++ b/pkg/ui/conflict/conflict_test.go @@ -20,21 +20,29 @@ func TestSolveFileConflict(t *testing.T) { expected []byte }{ { - name: "no_answer", + name: "keep_answer", filePath: "README.md", fileA: []byte("foo"), fileB: []byte("bar"), - input: "n\n", + input: "\n", expected: []byte("foo"), }, { - name: "yes_answer", + name: "overwrite_answer", filePath: "README.md", fileA: []byte("foo"), fileB: []byte("bar"), - input: "y\n", + input: "→\n", expected: []byte("bar"), }, + { + name: "diff_file_answer", + filePath: "README.md", + fileA: []byte("foo"), + fileB: []byte("bar"), + input: "→→\n", + expected: []byte("<<<<<<< Deleted\nfoo\n=======\nbar\n>>>>>>> Added\n"), + }, } for _, tc := range testCases { @@ -54,7 +62,7 @@ func TestSolveFileConflict(t *testing.T) { // Assert that the result is correct result := m.Result() if !bytes.Equal(result, tc.expected) { - t.Errorf("Unexpected result. Got %v, expected %v", result, tc.expected) + t.Errorf("Unexpected result for test: %s. Got %s, expected %s", tc.name, result, tc.expected) } }) }