MCPcopy
hub / github.com/algolia/instantsearch / createSingleSearchResponse

Function createSingleSearchResponse

tests/mocks/createAPIResponse.ts:37–67  ·  view source on GitHub ↗
(
  subset: Partial<SearchResponse<THit>> = {}
)

Source from the content-addressed store, hash-verified

35];
36
37export const createSingleSearchResponse = <THit = any>(
38 subset: Partial<SearchResponse<THit>> = {}
39): SearchResponse<THit> => {
40 const {
41 query = '',
42 page = 0,
43 hitsPerPage = 20,
44 hits = [],
45 nbHits = hits.length,
46 nbPages = Math.ceil(nbHits / hitsPerPage),
47 params = '',
48 exhaustiveNbHits = true,
49 exhaustiveFacetsCount = true,
50 processingTimeMS = 0,
51 ...rest
52 } = subset;
53
54 return {
55 page,
56 hitsPerPage,
57 nbHits,
58 nbPages,
59 processingTimeMS,
60 hits,
61 query,
62 params,
63 exhaustiveNbHits,
64 exhaustiveFacetsCount,
65 ...rest,
66 };
67};
68
69export const createMultiSearchResponse = <THit = any>(
70 ...args: Array<Partial<SearchResponse<THit>>>

Callers 15

createMockedSearchClientFunction · 0.90
createMockedSearchClientFunction · 0.90
createMockedSearchClientFunction · 0.90
getSearchClientFunction · 0.90
createMockedSearchClientFunction · 0.90
createMockedSearchClientFunction · 0.90
getSearchClientFunction · 0.90
createMockedSearchClientFunction · 0.90
renderComponentFunction · 0.90

Calls

no outgoing calls

Tested by 15

createMockedSearchClientFunction · 0.72
createMockedSearchClientFunction · 0.72
createMockedSearchClientFunction · 0.72
getSearchClientFunction · 0.72
createMockedSearchClientFunction · 0.72
createMockedSearchClientFunction · 0.72
getSearchClientFunction · 0.72
createMockedSearchClientFunction · 0.72
renderComponentFunction · 0.72
createPropsFunction · 0.72