test(15-04): complete PHPUnit map, migrations, FormatHTML, and search-gate tests

Named JOURNAL-001/002 fillable, FormatHTML unsafe tags, rollback/remigrate, RSS/categories/tags/media, and TestSearchGateOff with zero Typesense HTTP.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-10-06 19:18:53 +02:00
parent c5b44b6a5d
commit d09edde080
12 changed files with 833 additions and 80 deletions

View File

@@ -1,6 +1,9 @@
package journal
import (
"io/fs"
"os"
"path/filepath"
"strings"
"testing"
"time"
@@ -77,4 +80,80 @@ func TestJournalBuckets(t *testing.T) {
t.Fatalf("%s Key is nil", name)
}
}
hostYAML := filepath.Join("..", "sm-grzybyfunkcjonalne-app", "config", "http.yaml")
raw, err := os.ReadFile(hostYAML)
if err != nil {
return
}
if !strings.Contains(string(raw), "_journal/api/*") {
t.Fatalf("host CORS missing _journal/api/* in %s", hostYAML)
}
}
func TestJournalSVGEmbed(t *testing.T) {
p := &Plugin{}
fsys := p.AdminFS()
f, err := fsys.Open("assets/images/journal-icon.svg")
if err != nil {
t.Fatalf("AdminFS missing journal-icon.svg: %v", err)
}
_ = f.Close()
filter, err := fs.ReadFile(fsys, "controllers/posts/config_filter.yaml")
if err != nil {
t.Fatal(err)
}
if strings.Contains(string(filter), "conditions:") {
t.Fatal("config_filter.yaml still has conditions")
}
fields, err := fs.ReadFile(fsys, "models/post/fields.yaml")
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(fields), "type: mlmarkdown") {
t.Fatal("post fields.yaml content is not mlmarkdown")
}
}
func TestCabanaMarkdownFieldTypes(t *testing.T) {
path := filepath.Join("..", "summercms.go", "modules", "cabana", "form_schema.go")
raw, err := os.ReadFile(path)
if err != nil {
t.Fatalf("read %s: %v", path, err)
}
src := string(raw)
for _, typ := range []string{`"markdown"`, `"mltext"`, `"mlmarkdown"`} {
if !strings.Contains(src, typ) {
t.Fatalf("form_schema.go missing %s", typ)
}
}
}
func TestNoTideJournalFixtures(t *testing.T) {
roots := []string{
filepath.Join("..", "fonoteka.go", "parity"),
filepath.Join("..", "fonoteka.go", "modules", "tide"),
filepath.Join("..", "summercms.go", "modules", "tide"),
}
needle := "/_journal/api/v1"
for _, root := range roots {
if _, err := os.Stat(root); err != nil {
continue
}
err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
if err != nil || d.IsDir() {
return err
}
raw, readErr := os.ReadFile(path)
if readErr != nil {
return readErr
}
if strings.Contains(string(raw), needle) {
t.Errorf("%s newly mentions %s", path, needle)
}
return nil
})
if err != nil {
t.Fatal(err)
}
}
}