Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Katajisto committed Sep 20, 2024
1 parent bfb8956 commit c5644d8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/ui/conflict/conflict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
})
}
Expand Down

0 comments on commit c5644d8

Please sign in to comment.