Added test for DescriptionHTML

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
This commit is contained in:
Alexey Terentyev 2018-06-06 05:38:06 +03:00
parent a1f01b0d71
commit bf02f8d816
No known key found for this signature in database
GPG Key ID: 60D6C550AEEBB467

View File

@ -5,6 +5,7 @@
package models
import (
"fmt"
"path"
"testing"
@ -176,3 +177,14 @@ func TestTransferOwnership(t *testing.T) {
CheckConsistencyFor(t, &Repository{}, &User{}, &Team{})
}
func TestRepoDescriptionHTML(t *testing.T) {
url := "https://github.com/go-gitea/gitea"
description := "GitHub repo: (%s)"
repo := &Repository{Description: fmt.Sprintf(description, url)}
actual := repo.DescriptionHTML()
expected := fmt.Sprintf(description,
fmt.Sprintf(`<a href="%[1]s">%[1]s</a>`, url))
assert.EqualValues(t, expected, actual)
}