Files
vpwg/Go/internal/web/templates_smoke_test.go
T

40 lines
892 B
Go

package web
import (
"testing"
"amnezia-share/internal/config"
)
// TestLoadTemplatesParses is a smoke test that ensures every template file
// under web/templates parses cleanly (balanced defines, known functions,
// valid Go template syntax). It does not require a database connection.
func TestLoadTemplatesParses(t *testing.T) {
cfg := config.Config{WebDir: "../../web"}
tmpl, err := loadTemplates(cfg)
if err != nil {
t.Fatalf("loadTemplates: %v", err)
}
names := []string{
"page_install",
"page_login",
"page_cabinet_auth",
"page_cabinet",
"page_share",
"page_faq",
"page_rules",
"page_status",
"page_admin_index",
"page_admin_links",
"page_admin_renewal",
"page_admin_configs",
"page_admin_servers",
"page_admin_settings",
}
for _, n := range names {
if tmpl.Lookup(n) == nil {
t.Errorf("template %q not found after parsing", n)
}
}
}