owl-blogs/renderer_test.go

27 lines
584 B
Go
Raw Normal View History

2022-07-21 17:02:37 +00:00
package kiss_test
import (
"h4kor/kiss-social"
"strings"
"testing"
)
func TestCanRenderPost(t *testing.T) {
user := getTestUser()
post, _ := user.CreateNewPost("testpost")
2022-07-21 17:44:07 +00:00
result, _ := kiss.RenderPost(post)
2022-07-21 17:02:37 +00:00
if !strings.Contains(result, "<h1>testpost</h1>") {
t.Error("Post title not rendered as h1. Got: " + result)
}
}
2022-07-21 17:44:07 +00:00
func TestRendererUsesBaseTemplate(t *testing.T) {
user := getTestUser()
post, _ := user.CreateNewPost("testpost")
result, _ := kiss.RenderPost(post)
2022-07-23 07:11:25 +00:00
if !strings.Contains(result, "<html") {
2022-07-21 17:44:07 +00:00
t.Error("Base template not used. Got: " + result)
}
}