diff options
Diffstat (limited to 'modules/markup/markdown/meta_test.go')
-rw-r--r-- | modules/markup/markdown/meta_test.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/markup/markdown/meta_test.go b/modules/markup/markdown/meta_test.go index f525777a54..939646f8fd 100644 --- a/modules/markup/markdown/meta_test.go +++ b/modules/markup/markdown/meta_test.go @@ -6,6 +6,7 @@ package markdown import ( "fmt" + "strings" "testing" "code.gitea.io/gitea/modules/structs" @@ -13,6 +14,16 @@ import ( "github.com/stretchr/testify/assert" ) +func validateMetadata(it structs.IssueTemplate) bool { + /* + A legacy to keep the unit tests working. + Copied from the method "func (it IssueTemplate) Valid() bool", the original method has been removed. + Because it becomes quite complicated to validate an issue template which is support yaml form now. + The new way to validate an issue template is to call the Validate in modules/issue/template, + */ + return strings.TrimSpace(it.Name) != "" && strings.TrimSpace(it.About) != "" +} + func TestExtractMetadata(t *testing.T) { t.Run("ValidFrontAndBody", func(t *testing.T) { var meta structs.IssueTemplate @@ -20,7 +31,7 @@ func TestExtractMetadata(t *testing.T) { assert.NoError(t, err) assert.Equal(t, bodyTest, body) assert.Equal(t, metaTest, meta) - assert.True(t, meta.Valid()) + assert.True(t, validateMetadata(meta)) }) t.Run("NoFirstSeparator", func(t *testing.T) { @@ -41,7 +52,7 @@ func TestExtractMetadata(t *testing.T) { assert.NoError(t, err) assert.Equal(t, "", body) assert.Equal(t, metaTest, meta) - assert.True(t, meta.Valid()) + assert.True(t, validateMetadata(meta)) }) } |