import {useEffect} from 'react'; import {act, fireEvent, render, screen, waitFor} from 'sentry-test/reactTestingLibrary'; import type {AutoCompleteProps} from 'sentry/components/autoComplete'; import AutoComplete from 'sentry/components/autoComplete'; const items = [ { name: 'Apple', }, { name: 'Pineapple', }, { name: 'Orange', }, ]; /** * For every render, we push all injected params into `autoCompleteState`, we probably want to * assert against those instead of the wrapper's state since component state will be different if we have * "controlled" props where does not handle state */ describe('AutoComplete', function () { let input: HTMLInputElement; let autoCompleteState: any[] = []; const mocks = { onSelect: jest.fn(), onClose: jest.fn(), onOpen: jest.fn(), }; afterEach(() => { jest.resetAllMocks(); autoCompleteState = []; }); function List({ registerItemCount, itemCount, ...props }: { children: React.ReactNode; itemCount: number; registerItemCount: (count?: number) => void; }) { useEffect(() => void registerItemCount(itemCount), [itemCount, registerItemCount]); return