(t *testing.T)
| 94 | } |
| 95 | |
| 96 | func TestValidateBaseURL(t *testing.T) { |
| 97 | tests := []struct { |
| 98 | url string |
| 99 | wantErr bool |
| 100 | }{ |
| 101 | {"https://app.hey.com", false}, |
| 102 | {"http://localhost:3000", false}, |
| 103 | {"http://127.0.0.1:3000", false}, |
| 104 | {"http://app.hey.localhost:3003", false}, |
| 105 | {"http://insecure.example.com", true}, |
| 106 | {"app.hey.com", true}, // bare path, no scheme |
| 107 | {"http://[::1]:3000", false}, // IPv6 loopback |
| 108 | } |
| 109 | |
| 110 | for _, tt := range tests { |
| 111 | t.Run(tt.url, func(t *testing.T) { |
| 112 | err := validateBaseURL(tt.url) |
| 113 | if (err != nil) != tt.wantErr { |
| 114 | t.Errorf("validateBaseURL(%q) error = %v, wantErr %v", tt.url, err, tt.wantErr) |
| 115 | } |
| 116 | }) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | func TestSourceTracking(t *testing.T) { |
| 121 | tmp := t.TempDir() |
nothing calls this directly
no test coverage detected