This commit is contained in:
Niko Abeler 2022-12-05 18:46:00 +01:00
parent a717164334
commit e2ad05cf0d
2 changed files with 11 additions and 0 deletions

View File

@ -181,6 +181,8 @@ func (post *Post) RenderedContent() string {
// trim yaml block
// TODO this can be done nicer
trimmedData := bytes.TrimSpace(data)
// ensure that data ends with a newline
trimmedData = append(trimmedData, []byte("\n")...)
// check first line is ---
if string(trimmedData[0:4]) == "---\n" {
trimmedData = trimmedData[4:]

View File

@ -465,6 +465,15 @@ func TestComplexParallelWebmentions(t *testing.T) {
assertions.AssertLen(t, outs, 20)
}
func TestPostWithoutContent(t *testing.T) {
repo := getTestRepo(owl.RepoConfig{})
user, _ := repo.CreateUser("testuser")
post, _ := user.CreateNewPostFull(owl.PostMeta{}, "")
result := post.RenderedContent()
assertions.AssertEqual(t, result, "")
}
// func TestComplexParallelSimulatedProcessesWebmentions(t *testing.T) {
// repoName := testRepoName()
// repo, _ := owl.CreateRepository(repoName, owl.RepoConfig{})