Feat v0.10.0 panel manifest lifecycle (#84)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m50s
CI/CD / test-sqlite (push) Successful in 3m9s
CI/CD / build-and-deploy (push) Successful in 1m1s
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m50s
CI/CD / test-sqlite (push) Successful in 3m9s
CI/CD / build-and-deploy (push) Successful in 1m1s
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #84.
This commit is contained in:
@@ -349,3 +349,100 @@ func TestValidateManifest_AutoSynthesizeSurfaces(t *testing.T) {
|
||||
t.Errorf("expected layout 'editor', got %q", s["layout"])
|
||||
}
|
||||
}
|
||||
|
||||
// ── Panels validation (v0.10.0) ─────────────────────────────
|
||||
|
||||
func TestValidateManifest_PanelsProviderValid(t *testing.T) {
|
||||
m := map[string]any{
|
||||
"id": "my-notes",
|
||||
"title": "Notes",
|
||||
"panels": map[string]any{
|
||||
"reference": map[string]any{
|
||||
"entry": "js/panels/reference.js",
|
||||
"title": "Notes Reference",
|
||||
"icon": "📝",
|
||||
},
|
||||
},
|
||||
}
|
||||
info, err := ValidateManifest(m)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if !info.HasPanels {
|
||||
t.Error("expected HasPanels to be true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateManifest_PanelsProviderMissingEntry(t *testing.T) {
|
||||
m := map[string]any{
|
||||
"id": "my-notes",
|
||||
"title": "Notes",
|
||||
"panels": map[string]any{
|
||||
"reference": map[string]any{
|
||||
"title": "Notes Reference",
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err := ValidateManifest(m)
|
||||
if err == nil {
|
||||
t.Fatal("expected error for panel missing entry")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateManifest_PanelsProviderMissingTitle(t *testing.T) {
|
||||
m := map[string]any{
|
||||
"id": "my-notes",
|
||||
"title": "Notes",
|
||||
"panels": map[string]any{
|
||||
"reference": map[string]any{
|
||||
"entry": "js/panels/reference.js",
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err := ValidateManifest(m)
|
||||
if err == nil {
|
||||
t.Fatal("expected error for panel missing title")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateManifest_PanelsConsumerValid(t *testing.T) {
|
||||
m := map[string]any{
|
||||
"id": "my-chat",
|
||||
"title": "Chat",
|
||||
"panels": []any{"notes.reference", "notes.graph"},
|
||||
}
|
||||
info, err := ValidateManifest(m)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if len(info.PanelConsumers) != 2 {
|
||||
t.Fatalf("expected 2 panel consumers, got %d", len(info.PanelConsumers))
|
||||
}
|
||||
if info.PanelConsumers[0] != "notes.reference" {
|
||||
t.Errorf("expected 'notes.reference', got %q", info.PanelConsumers[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateManifest_PanelsConsumerInvalidFormat(t *testing.T) {
|
||||
m := map[string]any{
|
||||
"id": "my-chat",
|
||||
"title": "Chat",
|
||||
"panels": []any{"notes-no-dot"},
|
||||
}
|
||||
_, err := ValidateManifest(m)
|
||||
if err == nil {
|
||||
t.Fatal("expected error for consumer panel without dot separator")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateManifest_PanelsInvalidType(t *testing.T) {
|
||||
m := map[string]any{
|
||||
"id": "my-pkg",
|
||||
"title": "My Package",
|
||||
"panels": "invalid-string",
|
||||
}
|
||||
_, err := ValidateManifest(m)
|
||||
if err == nil {
|
||||
t.Fatal("expected error for panels as string (neither map nor array)")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user