docs(cabana,compass,conga): compile README Go examples via src= (quick-261118-qsd)

- cabana: the hand-written controller fence points at Post, PostsController
  and BlogPlugin declarations; TestDocsDeclarations now calls each of them
- compass: mailSettings and ExampleOpen; the YAML block matches the
  directory ExampleOpen writes
- conga: job, dispatch and progress fences reuse the Jobs page targets; new
  reindex and worker regions run in TestDocsDispatch (Docker), and the
  schedule fence is FeedPlugin.Schedule, checked by TestDocsSchedule
This commit is contained in:
Jakub Zych
2026-11-18 19:44:21 +01:00
parent a0f5b5e561
commit becb31fbef
5 changed files with 316 additions and 146 deletions

View File

@@ -2,6 +2,7 @@ package cabana_test
import (
"fmt"
"io/fs"
"os"
"testing"
@@ -81,9 +82,25 @@ func ExampleActivate() {
// false
}
// TestDocsDeclarations checks the plugin declarations the Backend pages show.
// TestDocsDeclarations checks the plugin declarations the Backend pages and
// the README show.
func TestDocsDeclarations(t *testing.T) {
p := &BlogPlugin{}
c := PostsController{}
if c.ID() != "acme.blog.posts" || c.ModelName() != "Post" || c.ConfigDir() != "controllers/posts" {
t.Fatalf("controller = %q %q %q", c.ID(), c.ModelName(), c.ConfigDir())
}
if _, ok := c.NewRecord().(*Post); !ok || (Post{}).TableName() != "acme_blog_posts" {
t.Fatalf("NewRecord() = %T, table %q", c.NewRecord(), Post{}.TableName())
}
if ctrls := p.AdminControllers(); len(ctrls) != 1 || ctrls[0].ID() != c.ID() {
t.Fatalf("AdminControllers() = %+v", ctrls)
}
for _, name := range []string{"controllers/posts/config_list.yaml", "controllers/posts/config_form.yaml", "models/post/columns.yaml", "models/post/fields.yaml"} {
if _, err := fs.Stat(p.AdminFS(), name); err != nil {
t.Fatalf("AdminFS(): %v", err)
}
}
if n := len(p.Permissions()); n != 2 {
t.Fatalf("Permissions() = %d entries", n)
}