(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestRewriteSchemes(t *testing.T) { |
| 60 | t.Parallel() |
| 61 | for _, tc := range []struct { |
| 62 | name string |
| 63 | baseURLs []string |
| 64 | rewrites map[string]string |
| 65 | expected []string |
| 66 | }{ |
| 67 | { |
| 68 | name: "no match", |
| 69 | baseURLs: []string{"https://foo.example.com", "https://bar.example.com"}, |
| 70 | rewrites: map[string]string{ |
| 71 | "http": "ws", |
| 72 | }, |
| 73 | expected: []string{"https://foo.example.com", "https://bar.example.com"}, |
| 74 | }, |
| 75 | { |
| 76 | name: "match", |
| 77 | baseURLs: []string{"https://foo.example.com", "https://bar.example.com"}, |
| 78 | rewrites: map[string]string{ |
| 79 | "https": "wss", |
| 80 | }, |
| 81 | expected: []string{ |
| 82 | "https://foo.example.com", "wss://foo.example.com", "https://bar.example.com", "wss://bar.example.com", |
| 83 | }, |
| 84 | }, |
| 85 | } { |
| 86 | t.Run(tc.name, func(t *testing.T) { |
| 87 | t.Parallel() |
| 88 | a := assertions.New(t) |
| 89 | actual := webui.RewriteSchemes(tc.rewrites, tc.baseURLs...) |
| 90 | a.So(actual, should.Resemble, tc.expected) |
| 91 | }) |
| 92 | } |
| 93 | } |
nothing calls this directly
no test coverage detected