Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
test: Add edge case for canCapturePublicURL nil inputs
rcourtman7cbb5c061d12
diff --git a/internal/api/router_test.go b/internal/api/router_test.goindex 1f1926067e..8c2cfb3258 100644--- a/internal/api/router_test.go+++ b/internal/api/router_test.go@@ -4,6 +4,8 @@ import ("net/http""net/http/httptest""testing"++ "github.com/rcourtman/pulse-go-rewrite/internal/config")func TestIsDirectLoopbackRequest(t *testing.T) {@@ -736,3 +738,45 @@ func TestShouldAppendForwardedPort(t *testing.T) {})}}++func TestCanCapturePublicURL_NilInputs(t *testing.T) {+ t.Parallel()++ req := httptest.NewRequest(http.MethodGet, "/", nil)+ cfg := &config.Config{}++ tests := []struct {+ name string+ cfg *config.Config+ req *http.Request+ want bool+ }{+ {+ name: "nil config",+ cfg: nil,+ req: req,+ want: false,+ },+ {+ name: "nil request",+ cfg: cfg,+ req: nil,+ want: false,+ },+ {+ name: "both nil",+ cfg: nil,+ req: nil,+ want: false,+ },+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ got := canCapturePublicURL(tt.cfg, tt.req)+ if got != tt.want {+ t.Errorf("canCapturePublicURL() = %v, want %v", got, tt.want)+ }+ })+ }+}