react-code-dataset / react-instantsearch /test /utils /InstantSearchHooksTestWrapper.tsx
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
916 Bytes
import React from 'react';
import { InstantSearch } from 'react-instantsearch-hooks';
import { createSearchClient } from '../mock';
import type { InstantSearchProps } from 'react-instantsearch-hooks';
const searchClient = createSearchClient({});
type InstantSearchHooksTestWrapperProps = {
children: React.ReactNode;
} & Partial<InstantSearchProps>;
export function InstantSearchHooksTestWrapper({
children,
...props
}: InstantSearchHooksTestWrapperProps) {
return (
<InstantSearch searchClient={searchClient} indexName="indexName" {...props}>
{children}
</InstantSearch>
);
}
export function createInstantSearchTestWrapper(
props?: Partial<InstantSearchProps>
) {
const client = createSearchClient({});
const wrapper = ({ children }) => (
<InstantSearch searchClient={client} indexName="indexName" {...props}>
{children}
</InstantSearch>
);
return wrapper;
}