Untuck tests out of __tests__ directories, colocate with program files

This commit is contained in:
Alex Gleason
2023-10-02 14:27:40 -05:00
parent 645ce60a5f
commit 3f640e9797
160 changed files with 223 additions and 681 deletions

View File

@ -1,107 +0,0 @@
test.skip('skip', () => {});
// import React from 'react';
// import { VirtuosoMockContext } from 'react-virtuoso';
// import { __stub } from 'soapbox/api';
// import { buildAccount } from 'soapbox/jest/factory';
// import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
// import { normalizeGroup, normalizeGroupRelationship, normalizeInstance } from 'soapbox/normalizers';
// import PendingGroupsRow from '../pending-groups-row';
// const userId = '1';
// let store: any = {
// me: userId,
// accounts: {
// [userId]: buildAccount({
// id: userId,
// acct: 'justin-username',
// display_name: 'Justin L',
// avatar: 'test.jpg',
// source: {
// chats_onboarded: false,
// },
// }),
// },
// };
// const renderApp = (store: any) => (
// render(
// <VirtuosoMockContext.Provider value={{ viewportHeight: 300, itemHeight: 100 }}>
// <PendingGroupsRow />
// </VirtuosoMockContext.Provider>,
// undefined,
// store,
// )
// );
// describe('<PendingGroupRows />', () => {
// describe('without the feature', () => {
// beforeEach(() => {
// store = {
// ...store,
// instance: normalizeInstance({
// version: '2.7.2 (compatible; Pleroma 2.3.0)',
// }),
// };
// });
// it('should not render', () => {
// renderApp(store);
// expect(screen.queryAllByTestId('pending-items-row')).toHaveLength(0);
// });
// });
// describe('with the feature', () => {
// beforeEach(() => {
// store = {
// ...store,
// instance: normalizeInstance({
// version: '3.4.1 (compatible; TruthSocial 1.0.0)',
// software: 'TRUTHSOCIAL',
// }),
// };
// });
// describe('without pending group requests', () => {
// beforeEach(() => {
// __stub((mock) => {
// mock.onGet('/api/v1/groups?pending=true').reply(200, []);
// });
// });
// it('should not render', () => {
// renderApp(store);
// expect(screen.queryAllByTestId('pending-items-row')).toHaveLength(0);
// });
// });
// describe('with pending group requests', () => {
// beforeEach(() => {
// __stub((mock) => {
// mock.onGet('/api/v1/groups').reply(200, [
// normalizeGroup({
// display_name: 'Group',
// id: '1',
// }),
// ]);
// mock.onGet('/api/v1/groups/relationships?id[]=1').reply(200, [
// normalizeGroupRelationship({
// id: '1',
// }),
// ]);
// });
// });
// it('should render the row', async () => {
// renderApp(store);
// await waitFor(() => {
// expect(screen.queryAllByTestId('pending-items-row')).toHaveLength(1);
// });
// });
// });
// });
// });

View File

@ -3,7 +3,7 @@ import React from 'react';
import { buildGroup } from 'soapbox/jest/factory';
import { render, screen } from 'soapbox/jest/test-helpers';
import GroupGridItem from '../group-grid-item';
import GroupGridItem from './group-grid-item';
describe('<GroupGridItem', () => {
it('should render correctly', () => {

View File

@ -3,7 +3,7 @@ import React from 'react';
import { buildGroup } from 'soapbox/jest/factory';
import { render, screen } from 'soapbox/jest/test-helpers';
import GroupListItem from '../group-list-item';
import GroupListItem from './group-list-item';
describe('<GroupListItem', () => {
it('should render correctly', () => {

View File

@ -3,7 +3,7 @@ import React from 'react';
import { render, screen, within } from 'soapbox/jest/test-helpers';
import LayoutButtons, { GroupLayout } from '../layout-buttons';
import LayoutButtons, { GroupLayout } from './layout-buttons';
describe('<LayoutButtons', () => {
describe('when LIST view', () => {

View File

@ -1,82 +0,0 @@
test.skip('skip', () => {});
// import userEvent from '@testing-library/user-event';
// import React from 'react';
// import { VirtuosoMockContext } from 'react-virtuoso';
// 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';
// import RecentSearches from '../recent-searches';
// 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,
// },
// }),
// },
// };
// const renderApp = (children: React.ReactNode) => (
// render(
// <VirtuosoMockContext.Provider value={{ viewportHeight: 300, itemHeight: 100 }}>
// {children}
// </VirtuosoMockContext.Provider>,
// undefined,
// store,
// )
// );
// describe('<RecentSearches />', () => {
// describe('with recent searches', () => {
// beforeEach(() => {
// saveGroupSearch(userId, 'foobar');
// });
// afterEach(() => {
// clearRecentGroupSearches(userId);
// });
// it('should render the recent searches', async () => {
// renderApp(<RecentSearches onSelect={vi.fn()} />);
// await waitFor(() => {
// expect(screen.getByTestId('recent-search')).toBeInTheDocument();
// });
// });
// it('should support clearing recent searches', async () => {
// renderApp(<RecentSearches onSelect={vi.fn()} />);
// expect(groupSearchHistory.get(userId)).toHaveLength(1);
// await userEvent.click(screen.getByTestId('clear-recent-searches'));
// expect(groupSearchHistory.get(userId)).toBeNull();
// });
// it('should support click events on the results', async () => {
// const handler = vi.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);
// });
// });
// describe('without recent searches', () => {
// it('should render the blankslate', async () => {
// renderApp(<RecentSearches onSelect={vi.fn()} />);
// expect(screen.getByTestId('recent-searches-blankslate')).toBeInTheDocument();
// });
// });
// });

View File

@ -2,7 +2,7 @@ import React from 'react';
import { render, screen } from 'soapbox/jest/test-helpers';
import Blankslate from '../blankslate';
import Blankslate from './blankslate';
describe('<Blankslate />', () => {

View File

@ -5,7 +5,7 @@ import { VirtuosoGridMockContext, VirtuosoMockContext } from 'react-virtuoso';
import { buildAccount, buildGroup } from 'soapbox/jest/factory';
import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
import Results from '../results';
import Results from './results';
const userId = '1';
const store = {

View File

@ -5,7 +5,7 @@ import { buildGroup } from 'soapbox/jest/factory';
import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
import { normalizeInstance } from 'soapbox/normalizers';
import Search from '../search';
import Search from './search';
const store = {
instance: normalizeInstance({

View File

@ -3,7 +3,7 @@ import React from 'react';
import { buildGroupTag } from 'soapbox/jest/factory';
import { render, screen } from 'soapbox/jest/test-helpers';
import TagListItem from '../tag-list-item';
import TagListItem from './tag-list-item';
describe('<TagListItem', () => {
it('should render correctly', () => {