You've already forked caddy-opnsense-blocker
Manage frontend vendors with npm and use Chart.js
This commit is contained in:
@@ -139,6 +139,12 @@ func TestHandlerServesOverviewAndManualActions(t *testing.T) {
|
||||
if !strings.Contains(recorder.Body.String(), "Top URLs by events") {
|
||||
t.Fatalf("overview page should expose the top URLs block")
|
||||
}
|
||||
if !strings.Contains(recorder.Body.String(), `/assets/chartjs/chart.umd.min.js`) {
|
||||
t.Fatalf("overview page should load local chart.js assets")
|
||||
}
|
||||
if !strings.Contains(recorder.Body.String(), `function mountDashboardChart(key, canvasId, config)`) {
|
||||
t.Fatalf("overview page should render the Chart.js dashboard helpers")
|
||||
}
|
||||
if !strings.Contains(recorder.Body.String(), "Loading…") {
|
||||
t.Fatalf("overview page should render stable loading placeholders")
|
||||
}
|
||||
@@ -218,6 +224,13 @@ func TestHandlerServesOverviewAndManualActions(t *testing.T) {
|
||||
t.Fatalf("tabulator asset should be served locally: status=%d len=%d", recorder.Code, recorder.Body.Len())
|
||||
}
|
||||
|
||||
recorder = httptest.NewRecorder()
|
||||
request = httptest.NewRequest(http.MethodGet, "/assets/chartjs/chart.umd.min.js", nil)
|
||||
handler.ServeHTTP(recorder, request)
|
||||
if recorder.Code != http.StatusOK || recorder.Body.Len() == 0 {
|
||||
t.Fatalf("chart.js asset should be served locally: status=%d len=%d", recorder.Code, recorder.Body.Len())
|
||||
}
|
||||
|
||||
recorder = httptest.NewRecorder()
|
||||
request = httptest.NewRequest(http.MethodGet, "/ips/203.0.113.10", nil)
|
||||
handler.ServeHTTP(recorder, request)
|
||||
|
||||
Reference in New Issue
Block a user