TestNormalizePathSegments tests path normalization including dot-segment removal
(t *testing.T)
| 166 | |
| 167 | // TestNormalizePathSegments tests path normalization including dot-segment removal |
| 168 | func TestNormalizePathSegments(t *testing.T) { |
| 169 | t.Parallel() |
| 170 | |
| 171 | testCases := []struct { |
| 172 | name string |
| 173 | input string |
| 174 | expected string |
| 175 | }{ |
| 176 | { |
| 177 | name: "EmptyString", |
| 178 | input: "", |
| 179 | expected: "/", |
| 180 | }, |
| 181 | { |
| 182 | name: "SimplePath", |
| 183 | input: "/api/v1", |
| 184 | expected: "/api/v1", |
| 185 | }, |
| 186 | { |
| 187 | name: "PathWithDotSegments", |
| 188 | input: "/api/../v1/./test", |
| 189 | expected: "/v1/test", |
| 190 | }, |
| 191 | { |
| 192 | name: "TrailingSlash", |
| 193 | input: "/api/v1/", |
| 194 | expected: "/api/v1", |
| 195 | }, |
| 196 | { |
| 197 | name: "MultipleSlashes", |
| 198 | input: "/api//v1///test", |
| 199 | expected: "/api//v1///test", |
| 200 | }, |
| 201 | } |
| 202 | |
| 203 | for _, tc := range testCases { |
| 204 | t.Run(tc.name, func(t *testing.T) { |
| 205 | t.Parallel() |
| 206 | result := normalizePathSegments(tc.input) |
| 207 | assert.Equal(t, tc.expected, result) |
| 208 | }) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | // TestExtractExpectedAudience tests audience extraction from HTTP requests |
| 213 | func TestExtractExpectedAudience(t *testing.T) { |
nothing calls this directly
no test coverage detected