diff options
Diffstat (limited to 'modules/repofiles/diff_test.go')
-rw-r--r-- | modules/repofiles/diff_test.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/repofiles/diff_test.go b/modules/repofiles/diff_test.go index 463ce4ec67..4bd1ef6f4d 100644 --- a/modules/repofiles/diff_test.go +++ b/modules/repofiles/diff_test.go @@ -9,6 +9,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/unittest" + "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/test" "code.gitea.io/gitea/services/gitdiff" @@ -118,13 +119,21 @@ func TestGetDiffPreview(t *testing.T) { t.Run("with given branch", func(t *testing.T) { diff, err := GetDiffPreview(ctx.Repo.Repository, branch, treePath, content) assert.NoError(t, err) - assert.EqualValues(t, expectedDiff, diff) + expectedBs, err := json.Marshal(expectedDiff) + assert.NoError(t, err) + bs, err := json.Marshal(diff) + assert.NoError(t, err) + assert.EqualValues(t, expectedBs, bs) }) t.Run("empty branch, same results", func(t *testing.T) { diff, err := GetDiffPreview(ctx.Repo.Repository, "", treePath, content) assert.NoError(t, err) - assert.EqualValues(t, expectedDiff, diff) + expectedBs, err := json.Marshal(expectedDiff) + assert.NoError(t, err) + bs, err := json.Marshal(diff) + assert.NoError(t, err) + assert.EqualValues(t, expectedBs, bs) }) } |