2023-06-21 02:44:07 +00:00
|
|
|
test.skip('skip', () => {});
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// import userEvent from '@testing-library/user-event';
|
|
|
|
// import React from 'react';
|
|
|
|
// import { VirtuosoMockContext } from 'react-virtuoso';
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// import { buildAccount } from 'soapbox/jest/factory';
|
|
|
|
// import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
|
|
|
// import { groupSearchHistory } from 'soapbox/settings';
|
|
|
|
// import { clearRecentGroupSearches, saveGroupSearch } from 'soapbox/utils/groups';
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// import RecentSearches from '../recent-searches';
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// const userId = '1';
|
|
|
|
// const store = {
|
|
|
|
// me: userId,
|
|
|
|
// accounts: {
|
|
|
|
// [userId]: buildAccount({
|
|
|
|
// id: userId,
|
|
|
|
// acct: 'justin-username',
|
|
|
|
// display_name: 'Justin L',
|
|
|
|
// avatar: 'test.jpg',
|
|
|
|
// source: {
|
|
|
|
// chats_onboarded: false,
|
|
|
|
// },
|
|
|
|
// }),
|
|
|
|
// },
|
|
|
|
// };
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// const renderApp = (children: React.ReactNode) => (
|
|
|
|
// render(
|
|
|
|
// <VirtuosoMockContext.Provider value={{ viewportHeight: 300, itemHeight: 100 }}>
|
|
|
|
// {children}
|
|
|
|
// </VirtuosoMockContext.Provider>,
|
|
|
|
// undefined,
|
|
|
|
// store,
|
|
|
|
// )
|
|
|
|
// );
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// describe('<RecentSearches />', () => {
|
|
|
|
// describe('with recent searches', () => {
|
|
|
|
// beforeEach(() => {
|
|
|
|
// saveGroupSearch(userId, 'foobar');
|
|
|
|
// });
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// afterEach(() => {
|
|
|
|
// clearRecentGroupSearches(userId);
|
|
|
|
// });
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// it('should render the recent searches', async () => {
|
|
|
|
// renderApp(<RecentSearches onSelect={jest.fn()} />);
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// await waitFor(() => {
|
|
|
|
// expect(screen.getByTestId('recent-search')).toBeInTheDocument();
|
|
|
|
// });
|
|
|
|
// });
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// it('should support clearing recent searches', async () => {
|
|
|
|
// renderApp(<RecentSearches onSelect={jest.fn()} />);
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// expect(groupSearchHistory.get(userId)).toHaveLength(1);
|
|
|
|
// await userEvent.click(screen.getByTestId('clear-recent-searches'));
|
|
|
|
// expect(groupSearchHistory.get(userId)).toBeNull();
|
|
|
|
// });
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// it('should support click events on the results', async () => {
|
|
|
|
// const handler = jest.fn();
|
|
|
|
// renderApp(<RecentSearches onSelect={handler} />);
|
|
|
|
// expect(handler.mock.calls.length).toEqual(0);
|
|
|
|
// await userEvent.click(screen.getByTestId('recent-search-result'));
|
|
|
|
// expect(handler.mock.calls.length).toEqual(1);
|
|
|
|
// });
|
|
|
|
// });
|
2023-03-01 14:43:30 +00:00
|
|
|
|
2023-06-21 02:44:07 +00:00
|
|
|
// describe('without recent searches', () => {
|
|
|
|
// it('should render the blankslate', async () => {
|
|
|
|
// renderApp(<RecentSearches onSelect={jest.fn()} />);
|
|
|
|
|
|
|
|
// expect(screen.getByTestId('recent-searches-blankslate')).toBeInTheDocument();
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// });
|