Files
marqdo/plugins/web/internal/page/page_test.go
T
cflmyandCursor 23e4bc406e feat(web): Go W-G7 RSS, sitemap, redirect, and SEO bags
Add paginate/meta wiring, RSS and sitemap builders, and app
redirect/error/sitemap/robots route bags so content and W7 offline
smokes pass on libweb.so.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 17:51:50 +08:00

42 lines
907 B
Go

package page_test
import (
"testing"
"github.com/marqdo/marqdo/plugins/web/internal/page"
)
func TestNewDefaults(t *testing.T) {
p := page.New(map[string]any{})
if p["title"] != "Marqdo Web" {
t.Fatalf("title=%v", p["title"])
}
if p["intro"] != "" {
t.Fatalf("intro=%v", p["intro"])
}
}
func TestNewZhAliases(t *testing.T) {
p := page.New(map[string]any{
"title": "T",
"壳样式": "minimal",
"布局": "bare",
"资源版本": "v1",
})
if p["shell_css"] != "minimal" || p["layout"] != "bare" || p["asset_version"] != "v1" {
t.Fatalf("%v", p)
}
}
func TestPaginateBag(t *testing.T) {
p := page.New(map[string]any{"title": "List"})
out := page.Paginate(p, 0, 5, "/")
pg, ok := out["paginate"].(map[string]any)
if !ok {
t.Fatalf("paginate=%v", out["paginate"])
}
if pg["offset"] != int64(0) || pg["limit"] != int64(5) || pg["path"] != "/" {
t.Fatalf("%v", pg)
}
}