(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func Test_validateProxyURL(t *testing.T) { |
| 10 | t.Parallel() |
| 11 | |
| 12 | testcases := []struct { |
| 13 | Name string |
| 14 | URL string |
| 15 | ExpectedError bool |
| 16 | }{ |
| 17 | { |
| 18 | Name: "Empty", |
| 19 | URL: "", |
| 20 | ExpectedError: true, |
| 21 | }, |
| 22 | { |
| 23 | Name: "EmptyWild", |
| 24 | URL: "", |
| 25 | ExpectedError: true, |
| 26 | }, |
| 27 | { |
| 28 | Name: "URL", |
| 29 | URL: "https://example.com", |
| 30 | ExpectedError: false, |
| 31 | }, |
| 32 | { |
| 33 | Name: "NoScheme", |
| 34 | URL: "example.com", |
| 35 | ExpectedError: true, |
| 36 | }, |
| 37 | { |
| 38 | Name: "BadScheme", |
| 39 | URL: "ssh://example.com", |
| 40 | ExpectedError: true, |
| 41 | }, |
| 42 | { |
| 43 | Name: "IncludePaths", |
| 44 | URL: "https://example.com/test", |
| 45 | ExpectedError: true, |
| 46 | }, |
| 47 | } |
| 48 | |
| 49 | for _, tt := range testcases { |
| 50 | t.Run(tt.Name, func(t *testing.T) { |
| 51 | t.Parallel() |
| 52 | |
| 53 | err := validateProxyURL(tt.URL) |
| 54 | if tt.ExpectedError { |
| 55 | require.Error(t, err) |
| 56 | } else { |
| 57 | require.NoError(t, err) |
| 58 | } |
| 59 | }) |
| 60 | } |
| 61 | } |
nothing calls this directly
no test coverage detected