package server import "testing" func TestRunNotificationWebClick(t *testing.T) { for _, tc := range []struct{ base, want string }{ {"https://pipelines.example.com", "https://pipelines.example.com/runs/20"}, {"http://10.0.0.75:8095/", "http://10.0.0.75:8095/runs/20"}, {"", "pipelines://run/20"}, // Existing Android-only installations. {"javascript:alert(1)", ""}, {"https://user:password@example.com", ""}, {"https://example.com?token=secret", ""}, {"https://example.com/#fragment", ""}, {"https://example.com/subpath", ""}, // Web app uses origin-root routes. {"/runs", ""}, {"https://example.com\r\nClick:bad", ""}, } { t.Run(tc.base, func(t *testing.T) { t.Setenv("PIPELINES_WEB_PUBLIC_URL", tc.base) if got := runAttentionClick(20); got != tc.want { t.Fatalf("click = %q, want %q", got, tc.want) } }) } }