import React from 'react';
import { InstantSearch, SearchBox } from 'react-instantsearch-dom';
import { render, fireEvent } from '@testing-library/react';
import Answers from '../Answers';
import { wait } from '../../../../../test/utils';
import { createSearchClient } from '../../../../../test/mock';
const createAnswersSearchClient = () =>
createSearchClient({
initIndex: () => ({
findAnswers: jest.fn(() =>
Promise.resolve({
hits: [{ title: 'hello' }],
})
),
}),
});
describe('Answers', () => {
let searchClient;
beforeEach(() => {
searchClient = createAnswersSearchClient();
});
it('renders empty Answers widget', () => {
const { container } = render(
is loading
:not loading
} />hits received
{JSON.stringify(hits)}
{JSON.stringify({ isLoading, hits })}
)
}
renderDebounceTime={0}
searchDebounceTime={0}
/>