MCPcopy Create free account
hub / github.com/GetStream/stream-go2 / Test_URLString

Function Test_URLString

url_internal_test.go:10–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func 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
50func Test_PersonalizationURLString(t *testing.T) {
51 testCases := []struct {

Callers

nothing calls this directly

Calls 2

newAPIURLBuilderFunction · 0.85
urlMethod · 0.65

Tested by

no test coverage detected