MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / TestCalcQueryParamsHash

Function TestCalcQueryParamsHash

proxy_test.go:1245–1299  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1243}
1244
1245func TestCalcQueryParamsHash(t *testing.T) {
1246 testCases := []struct {
1247 name string
1248 input url.Values
1249 expectedResult uint32
1250 }{
1251 {
1252 "nil Value",
1253 nil,
1254 0,
1255 },
1256 {
1257 "empty calcQueryParamsHash",
1258 url.Values{},
1259 0,
1260 },
1261 {
1262 "map with non param_ value",
1263 url.Values{"session_id": {"foo", "bar"}},
1264 0,
1265 },
1266 {
1267 "map with only param_ value",
1268 url.Values{"param_limit": {"1"}},
1269 0x94a386,
1270 },
1271 {
1272 "map with only param_ value. value affects result",
1273 url.Values{"param_limit": {"2"}},
1274 0x329bae01,
1275 },
1276 {
1277 "map with mix of param_ and non-param_ value",
1278 url.Values{"param_limit": {"1"}, "session_id": {"foo", "bar"}},
1279 0x94a386,
1280 },
1281 {
1282 "map with multiple param_ values",
1283 url.Values{"param_limit": {"1", "2"}, "param_table": {"foo"}},
1284 0x3a8a5c31,
1285 },
1286 {
1287 "map with multiple param_ values and only first value in array affects result",
1288 url.Values{"param_limit": {"1"}, "param_table": {"foo", "bar"}},
1289 0x3a8a5c31,
1290 },
1291 }
1292
1293 for _, tc := range testCases {
1294 t.Run(tc.name, func(t *testing.T) {
1295 r := calcQueryParamsHash(tc.input)
1296 assert.Equal(t, r, tc.expectedResult)
1297 })
1298 }
1299}
1300
1301// this function runs an number of heavyRequests using goroutines
1302// then waits that all the requests are currently handled by the fakeServer

Callers

nothing calls this directly

Calls 1

calcQueryParamsHashFunction · 0.85

Tested by

no test coverage detected