Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
canRefine: false,
precision: 2,
});
props = connect.getProvidedProps.call(
instance,
{
attribute: 'ok',
precision: 2,
contextValue,
indexContextValue,
},
{},
{
results: {
second: new SearchResults(new SearchParameters(), [{ hits: [] }]),
},
}
);
expect(props).toEqual({
min: undefined,
max: undefined,
currentRefinement: {
min: undefined,
max: undefined,
},
count: [],
canRefine: false,
precision: 2,
});
});
const createMultiIndexSearchResults = (hits = [], state) => ({
results: {
second: new SearchResults(new SearchParameters(state), [
{
hits,
},
]),
},
});
const createSingleIndexSearchResults = (hits = [], state) => ({
results: new SearchResults(new SearchParameters(state), [
{
hits,
},
]),
});
currentRefinement: { min: 6, max: 9 },
count: [],
canRefine: false,
precision: 2,
});
props = connect.getProvidedProps.call(
{},
{
attribute: 'ok',
precision: 2,
contextValue,
},
{},
{
results: new SearchResults(new SearchParameters(), [{ hits: [] }]),
}
);
expect(props).toEqual({
min: undefined,
max: undefined,
currentRefinement: {
min: undefined,
max: undefined,
},
count: [],
canRefine: false,
precision: 2,
});
expect(() =>
connect.getProvidedProps.call(
const createSearchResults = ({ disjunctiveFacets, facets }) =>
new SearchResults(
new SearchParameters({
disjunctiveFacets,
}),
[
{
facets,
hits: [
{ objectID: '0123', name: 'Apple' },
{ objectID: '0123', name: 'Samsung' },
{ objectID: '0123', name: 'Microsoft' },
],
},
]
);
}
if (Array.isArray(results)) {
return results.reduce(
(acc, result) => ({
...acc,
[result._internalIndexId]: new algoliasearchHelper.SearchResults(
new algoliasearchHelper.SearchParameters(result.state),
result.rawResults
),
}),
{}
);
}
return new algoliasearchHelper.SearchResults(
new algoliasearchHelper.SearchParameters(results.state),
results.rawResults
);
}
(acc, result) => ({
...acc,
[result._internalIndexId]: new algoliasearchHelper.SearchResults(
new algoliasearchHelper.SearchParameters(result.state),
result.rawResults
),
}),
{}
export const deserialize = function(data) {
const client = algoliaClient(data.appId, data.apiKey);
const helper = algoliaHelper(
client,
data.searchParameters.index,
data.searchParameters
);
if (data.response) {
helper.lastResults = new algoliaHelper.SearchResults(
helper.state,
data.response
);
}
return helper;
};