Skip to content
Merged
26 changes: 26 additions & 0 deletions internal/admin/dashboard/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func TestIndex_ReturnsHTML(t *testing.T) {
if !strings.Contains(body, "audit logs") {
t.Errorf("expected audit logs navigation item in page HTML")
}
if !strings.Contains(body, "workflows") {
t.Errorf("expected workflows navigation item in page HTML")
}
if !strings.Contains(body, `x-data="dashboard()"`) {
t.Errorf("expected alpine dashboard root in page HTML")
}
Expand Down Expand Up @@ -150,6 +153,29 @@ func TestStatic_ServesAliasesModuleJS(t *testing.T) {
}
}

func TestStatic_ServesExecutionPlansModuleJS(t *testing.T) {
h, err := New()
if err != nil {
t.Fatalf("New() returned error: %v", err)
}

e := echo.New()
req := httptest.NewRequest(http.MethodGet, "/admin/static/js/modules/execution-plans.js", nil)
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)

if err := h.Static(c); err != nil {
t.Fatalf("Static() returned error: %v", err)
}

if rec.Code != http.StatusOK {
t.Errorf("expected 200, got %d", rec.Code)
}
if rec.Body.Len() == 0 {
t.Error("expected non-empty body for execution plans module JS file")
}
}

func TestStatic_ServesFavicon(t *testing.T) {
h, err := New()
if err != nil {
Expand Down
Loading
Loading