(t *testing.T, handler http.HandlerFunc)
| 10 | ) |
| 11 | |
| 12 | func newTestServer(t *testing.T, handler http.HandlerFunc) { |
| 13 | server := httptest.NewServer(handler) |
| 14 | oldURL := searchURL |
| 15 | searchURL = server.URL |
| 16 | t.Cleanup(func() { |
| 17 | searchURL = oldURL |
| 18 | server.Close() |
| 19 | }) |
| 20 | } |
| 21 | |
| 22 | func TestSearchSendsRequestAndFormatsResults(t *testing.T) { |
| 23 | newTestServer(t, func(w http.ResponseWriter, r *http.Request) { |
no test coverage detected