diff options
Diffstat (limited to 'modules/repofiles/content_test.go')
-rw-r--r-- | modules/repofiles/content_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/repofiles/content_test.go b/modules/repofiles/content_test.go index ef6c5eafc2..cd98c54ea6 100644 --- a/modules/repofiles/content_test.go +++ b/modules/repofiles/content_test.go @@ -190,3 +190,19 @@ func TestGetContentsOrListErrors(t *testing.T) { assert.Nil(t, fileContentResponse) }) } + +func TestGetContentsOrListOfEmptyRepos(t *testing.T) { + models.PrepareTestEnv(t) + ctx := test.MockContext(t, "user2/repo15") + ctx.SetParams(":id", "15") + test.LoadRepo(t, ctx, 15) + test.LoadUser(t, ctx, 2) + test.LoadGitRepo(t, ctx) + repo := ctx.Repo.Repository + + t.Run("empty repo", func(t *testing.T) { + contents, err := GetContentsOrList(repo, "", "") + assert.NoError(t, err) + assert.Empty(t, contents) + }) +} |