mirror of
https://github.com/Dvorinka/Dash.git
synced 2026-06-04 07:22:56 +00:00
b17a06fbba
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
36 lines
805 B
Go
36 lines
805 B
Go
package validation
|
|
|
|
import "testing"
|
|
|
|
func TestAbsoluteHTTP(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
raw string
|
|
wantErr bool
|
|
}{
|
|
{"http", "http://localhost:3000", false},
|
|
{"https", "https://example.com", false},
|
|
{"relative", "/pihole", true},
|
|
{"ftp", "ftp://example.com", true},
|
|
{"missing host", "https://", true},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
_, err := AbsoluteHTTP(tt.raw, "url")
|
|
if (err != nil) != tt.wantErr {
|
|
t.Fatalf("AbsoluteHTTP() error = %v, wantErr %v", err, tt.wantErr)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestName(t *testing.T) {
|
|
if got, err := Name(" Pi-hole "); err != nil || got != "Pi-hole" {
|
|
t.Fatalf("Name() = %q, %v", got, err)
|
|
}
|
|
if _, err := Name(""); err == nil {
|
|
t.Fatal("Name() accepted empty value")
|
|
}
|
|
}
|