(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestInjectMuxVars(t *testing.T) { |
| 24 | ctx := context.Background() |
| 25 | req := &http.Request{ |
| 26 | Method: "GET", |
| 27 | URL: &url.URL{Path: "/test"}, |
| 28 | } |
| 29 | |
| 30 | vars := map[string]string{ |
| 31 | "traceID": "test-trace-id", |
| 32 | "tagName": "test-tag", |
| 33 | } |
| 34 | |
| 35 | newReq, newCtx := injectMuxVars(ctx, req, vars) |
| 36 | |
| 37 | // Verify vars are set in the request |
| 38 | actualVars := mux.Vars(newReq) |
| 39 | require.Equal(t, "test-trace-id", actualVars["traceID"]) |
| 40 | require.Equal(t, "test-tag", actualVars["tagName"]) |
| 41 | |
| 42 | require.Equal(t, newReq.Context(), newCtx) |
| 43 | } |
| 44 | |
| 45 | func TestHandleSearch(t *testing.T) { |
| 46 | server, callAndTestResults := testFrontend() |
nothing calls this directly
no test coverage detected