import userEvent from '@testing-library/user-event';
import React from 'react';
import { __stub } from 'soapbox/api';
import { render, screen, waitFor } from '../../../../jest/test-helpers';
import Search from '../search';
describe('', () => {
it('successfully renders', async() => {
render();
expect(screen.getByLabelText('Search')).toBeInTheDocument();
});
it('handles onChange', async() => {
__stub(mock => {
mock.onGet('/api/v1/accounts/search').reply(200, [{ id: 1 }]);
});
const user = userEvent.setup();
render();
await user.type(screen.getByLabelText('Search'), '@jus');
await waitFor(() => {
expect(screen.getByLabelText('Search')).toHaveValue('@jus');
expect(screen.getByTestId('account')).toBeInTheDocument();
});
});
});