mirror of
https://github.com/Dvorinka/Dash.git
synced 2026-06-03 23:12:56 +00:00
🚀 Dash - Homelab Dashboard
A clean, customizable homelab dashboard inspired by CasaOS. Features: - Empty-first dashboard (no demo data) - 3 themes: Light, Dark, CasaOS glassmorphism - Widgets: Clock (multi-timezone), Pi-hole, Memos, Immich, Image - Drag & drop app organization - Grid + list view for apps - Groups with collapse/expand - Proper widget refresh handling - Visual timezone picker - Square app cards with hover effects Stack: Go + Gin + PostgreSQL + Next.js 15 + React 19 + Tailwind CSS + shadcn/ui
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package widgets
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNormalizePiHoleClassicSummary(t *testing.T) {
|
||||
got, err := normalizePiHole(map[string]any{
|
||||
"ads_blocked_today": float64(25),
|
||||
"dns_queries_today": float64(100),
|
||||
"ads_percentage_today": float64(25),
|
||||
"status": "enabled",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var payload map[string]any
|
||||
if err := json.Unmarshal(got, &payload); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if payload["blockedCount"] != float64(25) || payload["queryCount"] != float64(100) {
|
||||
t.Fatalf("unexpected payload: %v", payload)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizePiHoleV6Summary(t *testing.T) {
|
||||
got, err := normalizePiHole(map[string]any{
|
||||
"queries": map[string]any{
|
||||
"blocked": float64(30),
|
||||
"total": float64(120),
|
||||
"percent_blocked": float64(25),
|
||||
},
|
||||
"status": "enabled",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var payload map[string]any
|
||||
if err := json.Unmarshal(got, &payload); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if payload["percentBlocked"] != float64(25) {
|
||||
t.Fatalf("unexpected payload: %v", payload)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user