(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func Test_URLString(t *testing.T) { |
| 11 | testCases := []struct { |
| 12 | urlBuilder apiURLBuilder |
| 13 | expected string |
| 14 | }{ |
| 15 | { |
| 16 | urlBuilder: apiURLBuilder{}, |
| 17 | expected: fmt.Sprintf("https://api.%s/api/v1.0/", domain), |
| 18 | }, |
| 19 | { |
| 20 | urlBuilder: newAPIURLBuilder("", "us-east", "2.0"), |
| 21 | expected: fmt.Sprintf("https://us-east-api.%s/api/v2.0/", domain), |
| 22 | }, |
| 23 | { |
| 24 | urlBuilder: newAPIURLBuilder("", "eu-west", "2.0"), |
| 25 | expected: fmt.Sprintf("https://eu-west-api.%s/api/v2.0/", domain), |
| 26 | }, |
| 27 | { |
| 28 | urlBuilder: newAPIURLBuilder("", "singapore", "2.0"), |
| 29 | expected: fmt.Sprintf("https://singapore-api.%s/api/v2.0/", domain), |
| 30 | }, |
| 31 | { |
| 32 | urlBuilder: newAPIURLBuilder("http://localhost:8000", "singapore", "1.0"), |
| 33 | expected: "http://localhost:8000/api/v1.0/", |
| 34 | }, |
| 35 | { |
| 36 | urlBuilder: newAPIURLBuilder("http://localhost:8000", "", "1.0"), |
| 37 | expected: "http://localhost:8000/api/v1.0/", |
| 38 | }, |
| 39 | { |
| 40 | urlBuilder: newAPIURLBuilder("http://localhost:8000", "", "2.0"), |
| 41 | expected: "http://localhost:8000/api/v2.0/", |
| 42 | }, |
| 43 | } |
| 44 | |
| 45 | for _, tc := range testCases { |
| 46 | assert.Equal(t, tc.expected, tc.urlBuilder.url()) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | func Test_PersonalizationURLString(t *testing.T) { |
| 51 | testCases := []struct { |
nothing calls this directly
no test coverage detected