- Razbijen monolitni server_test.go na fokusirane test fajlove: api_test.go, dashboard_test.go, docs_test.go, search_test.go, submit_test.go, task_detail_test.go, console_test.go, sse_test.go, timestamp_test.go, ui_test.go, test_helpers_test.go - Dodat logs.go handler (handleLogsTail) koji je nedostajao - Dodat LogFile u config - Fix konzola: prompt se šalje preko fajla umesto direktno u PTY - 192 testova prolazi Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
81 lines
2.0 KiB
Go
81 lines
2.0 KiB
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestDashboard_EscapeClosesOverlay(t *testing.T) {
|
|
srv := setupTestServer(t)
|
|
|
|
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
|
w := httptest.NewRecorder()
|
|
srv.Router.ServeHTTP(w, req)
|
|
|
|
body := w.Body.String()
|
|
if !containsStr(body, "Escape") {
|
|
t.Error("expected Escape key handler for overlay")
|
|
}
|
|
}
|
|
|
|
func TestDashboard_BackdropClickClosesOverlay(t *testing.T) {
|
|
srv := setupTestServer(t)
|
|
|
|
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
|
w := httptest.NewRecorder()
|
|
srv.Router.ServeHTTP(w, req)
|
|
|
|
body := w.Body.String()
|
|
if !containsStr(body, "e.target === this") {
|
|
t.Error("expected backdrop click handler for overlay")
|
|
}
|
|
}
|
|
|
|
func TestTaskDetail_HasInnerWrapper(t *testing.T) {
|
|
srv := setupTestServer(t)
|
|
|
|
req := httptest.NewRequest(http.MethodGet, "/task/T01", nil)
|
|
w := httptest.NewRecorder()
|
|
srv.Router.ServeHTTP(w, req)
|
|
|
|
body := w.Body.String()
|
|
if !containsStr(body, "detail-inner") {
|
|
t.Error("expected detail-inner wrapper in task detail")
|
|
}
|
|
}
|
|
|
|
func TestTaskDetail_RendersMarkdownAsHTML(t *testing.T) {
|
|
srv := setupTestServer(t)
|
|
|
|
req := httptest.NewRequest(http.MethodGet, "/task/T01", nil)
|
|
w := httptest.NewRecorder()
|
|
srv.Router.ServeHTTP(w, req)
|
|
|
|
body := w.Body.String()
|
|
// Markdown headers should be rendered as HTML <h1> tags
|
|
if !containsStr(body, "<h1>") {
|
|
t.Error("expected rendered <h1> from markdown heading")
|
|
}
|
|
// Should have docs-content class for proper styling
|
|
if !containsStr(body, "docs-content") {
|
|
t.Error("expected docs-content class on detail content")
|
|
}
|
|
}
|
|
|
|
func TestDocsPage_HasFullHeightLayout(t *testing.T) {
|
|
srv := setupTestServer(t)
|
|
|
|
req := httptest.NewRequest(http.MethodGet, "/docs", nil)
|
|
w := httptest.NewRecorder()
|
|
srv.Router.ServeHTTP(w, req)
|
|
|
|
body := w.Body.String()
|
|
if !containsStr(body, "docs-container") {
|
|
t.Error("expected docs-container class")
|
|
}
|
|
if !containsStr(body, "docs-layout") {
|
|
t.Error("expected docs-layout class for grid layout")
|
|
}
|
|
}
|