Untuck tests out of __tests__ directories, colocate with program files
This commit is contained in:
parent
645ce60a5f
commit
3f640e9797
|
@ -9,7 +9,7 @@ import {
|
|||
FETCH_ABOUT_PAGE_SUCCESS,
|
||||
FETCH_ABOUT_PAGE_FAIL,
|
||||
fetchAboutPage,
|
||||
} from '../about';
|
||||
} from './about';
|
||||
|
||||
describe('fetchAboutPage()', () => {
|
||||
it('creates the expected actions on success', () => {
|
|
@ -1,7 +1,7 @@
|
|||
import { __stub } from 'soapbox/api';
|
||||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { submitAccountNote } from '../account-notes';
|
||||
import { submitAccountNote } from './account-notes';
|
||||
|
||||
describe('submitAccountNote()', () => {
|
||||
let store: ReturnType<typeof mockStore>;
|
|
@ -3,9 +3,9 @@ import { Map as ImmutableMap } from 'immutable';
|
|||
import { __stub } from 'soapbox/api';
|
||||
import { buildInstance, buildRelationship } from 'soapbox/jest/factory';
|
||||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeAccount } from 'soapbox/normalizers';
|
||||
import { ListRecord, ReducerRecord } from 'soapbox/reducers/user-lists';
|
||||
|
||||
import { normalizeAccount } from '../../normalizers';
|
||||
import {
|
||||
authorizeFollowRequest,
|
||||
blockAccount,
|
||||
|
@ -25,7 +25,7 @@ import {
|
|||
unblockAccount,
|
||||
unmuteAccount,
|
||||
unsubscribeAccount,
|
||||
} from '../accounts';
|
||||
} from './accounts';
|
||||
|
||||
let store: ReturnType<typeof mockStore>;
|
||||
|
|
@ -2,7 +2,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { ListRecord, ReducerRecord as UserListsRecord } from 'soapbox/reducers/user-lists';
|
||||
|
||||
import { expandBlocks, fetchBlocks } from '../blocks';
|
||||
import { expandBlocks, fetchBlocks } from './blocks';
|
||||
|
||||
const account = {
|
||||
acct: 'twoods',
|
|
@ -4,8 +4,8 @@ import { buildInstance } from 'soapbox/jest/factory';
|
|||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { ReducerCompose } from 'soapbox/reducers/compose';
|
||||
|
||||
import { uploadCompose, submitCompose } from '../compose';
|
||||
import { STATUS_CREATE_REQUEST } from '../statuses';
|
||||
import { uploadCompose, submitCompose } from './compose';
|
||||
import { STATUS_CREATE_REQUEST } from './statuses';
|
||||
|
||||
import type { IntlShape } from 'react-intl';
|
||||
|
|
@ -5,7 +5,7 @@ import { buildAccount } from 'soapbox/jest/factory';
|
|||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { AuthUserRecord, ReducerRecord } from 'soapbox/reducers/auth';
|
||||
|
||||
import { fetchMe, patchMe } from '../me';
|
||||
import { fetchMe, patchMe } from './me';
|
||||
|
||||
vi.mock('../../storage/kv-store', () => ({
|
||||
__esModule: true,
|
|
@ -4,7 +4,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeNotification } from 'soapbox/normalizers';
|
||||
|
||||
import { markReadNotifications } from '../notifications';
|
||||
import { markReadNotifications } from './notifications';
|
||||
|
||||
describe('markReadNotifications()', () => {
|
||||
it('fires off marker when top notification is newer than lastRead', async() => {
|
|
@ -1,6 +1,6 @@
|
|||
import { mockStore, mockWindowProperty, rootState } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { checkOnboardingStatus, startOnboarding, endOnboarding } from '../onboarding';
|
||||
import { checkOnboardingStatus, startOnboarding, endOnboarding } from './onboarding';
|
||||
|
||||
describe('checkOnboarding()', () => {
|
||||
let mockGetItem: any;
|
|
@ -3,12 +3,12 @@ import { Map as ImmutableMap } from 'immutable';
|
|||
import { __stub } from 'soapbox/api';
|
||||
import { mockStore } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { VERIFY_CREDENTIALS_REQUEST } from '../auth';
|
||||
import { ACCOUNTS_IMPORT } from '../importer';
|
||||
import { VERIFY_CREDENTIALS_REQUEST } from './auth';
|
||||
import { ACCOUNTS_IMPORT } from './importer';
|
||||
import {
|
||||
MASTODON_PRELOAD_IMPORT,
|
||||
preloadMastodon,
|
||||
} from '../preload';
|
||||
} from './preload';
|
||||
|
||||
describe('preloadMastodon()', () => {
|
||||
it('creates the expected actions', () => {
|
|
@ -1,7 +1,7 @@
|
|||
import { __stub } from 'soapbox/api';
|
||||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { fetchRules, RULES_FETCH_REQUEST, RULES_FETCH_SUCCESS } from '../rules';
|
||||
import { fetchRules, RULES_FETCH_REQUEST, RULES_FETCH_SUCCESS } from './rules';
|
||||
|
||||
describe('fetchRules()', () => {
|
||||
it('sets the rules', async () => {
|
|
@ -1,7 +1,7 @@
|
|||
import { rootState } from 'soapbox/jest/test-helpers';
|
||||
import { RootState } from 'soapbox/store';
|
||||
|
||||
import { getSoapboxConfig } from '../soapbox';
|
||||
import { getSoapboxConfig } from './soapbox';
|
||||
|
||||
const ASCII_HEART = '❤'; // '\u2764\uFE0F'
|
||||
const RED_HEART_RGI = '❤️'; // '\u2764'
|
|
@ -4,7 +4,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { StatusListRecord } from 'soapbox/reducers/status-lists';
|
||||
|
||||
import { fetchStatusQuotes, expandStatusQuotes } from '../status-quotes';
|
||||
import { fetchStatusQuotes, expandStatusQuotes } from './status-quotes';
|
||||
|
||||
const status = {
|
||||
account: {
|
|
@ -5,7 +5,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeStatus } from 'soapbox/normalizers/status';
|
||||
|
||||
import { deleteStatus, fetchContext } from '../statuses';
|
||||
import { deleteStatus, fetchContext } from './statuses';
|
||||
|
||||
describe('fetchContext()', () => {
|
||||
it('handles Mitra context', async () => {
|
|
@ -2,7 +2,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { buildGroup } from 'soapbox/jest/factory';
|
||||
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { useGroup } from '../useGroup';
|
||||
import { useGroup } from './useGroup';
|
||||
|
||||
const group = buildGroup({ id: '1', display_name: 'soapbox' });
|
||||
|
|
@ -2,7 +2,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { buildGroup } from 'soapbox/jest/factory';
|
||||
import { renderHook, rootState, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { useGroupLookup } from '../useGroupLookup';
|
||||
import { useGroupLookup } from './useGroupLookup';
|
||||
|
||||
const group = buildGroup({ id: '1', slug: 'soapbox' });
|
||||
const state = rootState.setIn(['instance', 'version'], '3.4.1 (compatible; TruthSocial 1.0.0)');
|
|
@ -2,7 +2,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { buildStatus } from 'soapbox/jest/factory';
|
||||
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { useGroupMedia } from '../useGroupMedia';
|
||||
import { useGroupMedia } from './useGroupMedia';
|
||||
|
||||
const status = buildStatus();
|
||||
const groupId = '1';
|
|
@ -3,7 +3,7 @@ import { buildGroupMember } from 'soapbox/jest/factory';
|
|||
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
|
||||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
|
||||
import { useGroupMembers } from '../useGroupMembers';
|
||||
import { useGroupMembers } from './useGroupMembers';
|
||||
|
||||
const groupMember = buildGroupMember();
|
||||
const groupId = '1';
|
|
@ -3,7 +3,7 @@ import { buildGroup } from 'soapbox/jest/factory';
|
|||
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeInstance } from 'soapbox/normalizers';
|
||||
|
||||
import { useGroups } from '../useGroups';
|
||||
import { useGroups } from './useGroups';
|
||||
|
||||
const group = buildGroup({ id: '1', display_name: 'soapbox' });
|
||||
const store = {
|
|
@ -4,7 +4,7 @@ import { buildAccount, buildGroup } from 'soapbox/jest/factory';
|
|||
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeInstance } from 'soapbox/normalizers';
|
||||
|
||||
import { usePendingGroups } from '../usePendingGroups';
|
||||
import { usePendingGroups } from './usePendingGroups';
|
||||
|
||||
const id = '1';
|
||||
const group = buildGroup({ id, display_name: 'soapbox' });
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { buildAccount } from 'soapbox/jest/factory';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { render, screen } from '../../jest/test-helpers';
|
||||
import Account from '../account';
|
||||
import Account from './account';
|
||||
|
||||
describe('<Account />', () => {
|
||||
it('renders account name and username', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../jest/test-helpers';
|
||||
import AutosuggestEmoji from '../autosuggest-emoji';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import AutosuggestEmoji from './autosuggest-emoji';
|
||||
|
||||
describe('<AutosuggestEmoji />', () => {
|
||||
it('renders native emoji', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../jest/test-helpers';
|
||||
import Badge from '../badge';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Badge from './badge';
|
||||
|
||||
describe('<Badge />', () => {
|
||||
it('renders correctly', () => {
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { buildAccount } from 'soapbox/jest/factory';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { render, screen } from '../../jest/test-helpers';
|
||||
import DisplayName from '../display-name';
|
||||
import DisplayName from './display-name';
|
||||
|
||||
describe('<DisplayName />', () => {
|
||||
it('renders display name + account name', () => {
|
|
@ -7,7 +7,7 @@ import { __stub } from 'soapbox/api';
|
|||
import { mockStore, render, screen, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { type Poll } from 'soapbox/schemas';
|
||||
|
||||
import PollFooter from '../poll-footer';
|
||||
import PollFooter from './poll-footer';
|
||||
|
||||
let poll: Poll = {
|
||||
id: '1',
|
|
@ -1,8 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen, rootState } from '../../jest/test-helpers';
|
||||
import { normalizeStatus, normalizeAccount } from '../../normalizers';
|
||||
import QuotedStatus from '../quoted-status';
|
||||
import { render, screen, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeStatus, normalizeAccount } from 'soapbox/normalizers';
|
||||
|
||||
import QuotedStatus from './quoted-status';
|
||||
|
||||
import type { ReducerStatus } from 'soapbox/reducers/statuses';
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
import React from 'react';
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import { render, screen } from '../../jest/test-helpers';
|
||||
import ScrollTopButton from '../scroll-top-button';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import ScrollTopButton from './scroll-top-button';
|
||||
|
||||
const messages = defineMessages({
|
||||
queue: { id: 'status_list.queue_label', defaultMessage: 'Click to see {count} new {count, plural, one {post} other {posts}}' },
|
|
@ -4,7 +4,7 @@ import { buildAccount } from 'soapbox/jest/factory';
|
|||
import { render, screen, rootState } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeStatus } from 'soapbox/normalizers';
|
||||
|
||||
import Status from '../status';
|
||||
import Status from './status';
|
||||
|
||||
import type { ReducerStatus } from 'soapbox/reducers/statuses';
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
import { Map as ImmutableMap } from 'immutable';
|
||||
import React from 'react';
|
||||
|
||||
import { fireEvent, render, rootState, screen } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeStatus } from 'soapbox/normalizers';
|
||||
import { ReducerStatus } from 'soapbox/reducers/statuses';
|
||||
|
||||
import { fireEvent, render, rootState, screen } from '../../../jest/test-helpers';
|
||||
import SensitiveContentOverlay from '../sensitive-content-overlay';
|
||||
import SensitiveContentOverlay from './sensitive-content-overlay';
|
||||
|
||||
describe('<SensitiveContentOverlay />', () => {
|
||||
let status: ReducerStatus;
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import Avatar from '../avatar';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Avatar from './avatar';
|
||||
|
||||
const src = '/static/alice.jpg';
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { fireEvent, render, screen } from '../../../../jest/test-helpers';
|
||||
import Button from '../button';
|
||||
import { fireEvent, render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Button from './button';
|
||||
|
||||
describe('<Button />', () => {
|
||||
it('renders the given text', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import { Card, CardBody, CardHeader, CardTitle } from '../card';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { Card, CardBody, CardHeader, CardTitle } from './card';
|
||||
|
||||
describe('<Card />', () => {
|
||||
it('renders the CardTitle and CardBody', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import { Column } from '../column';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { Column } from './column';
|
||||
|
||||
describe('<Column />', () => {
|
||||
it('renders correctly with minimal props', () => {
|
|
@ -1,8 +1,9 @@
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { queryAllByRole, render, screen } from '../../../../jest/test-helpers';
|
||||
import Datepicker from '../datepicker';
|
||||
import { queryAllByRole, render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Datepicker from './datepicker';
|
||||
|
||||
describe('<Datepicker />', () => {
|
||||
it('defaults to the current date', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import Divider from '../divider';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Divider from './divider';
|
||||
|
||||
describe('<Divider />', () => {
|
||||
it('renders without text', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import Emoji from '../emoji';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Emoji from './emoji';
|
||||
|
||||
describe('<Emoji />', () => {
|
||||
it('renders a simple emoji', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import FormActions from '../form-actions';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import FormActions from './form-actions';
|
||||
|
||||
describe('<FormActions />', () => {
|
||||
it('renders successfully', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import FormGroup from '../form-group';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import FormGroup from './form-group';
|
||||
|
||||
describe('<FormGroup />', () => {
|
||||
it('connects the label and input', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { fireEvent, render, screen } from '../../../../jest/test-helpers';
|
||||
import Form from '../form';
|
||||
import { fireEvent, render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Form from './form';
|
||||
|
||||
describe('<Form />', () => {
|
||||
it('renders children', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import SvgIcon from '../svg-icon';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import SvgIcon from './svg-icon';
|
||||
|
||||
describe('<SvgIcon />', () => {
|
||||
it('renders loading element with default size', () => {
|
|
@ -1,8 +1,9 @@
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import Modal from '../modal';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Modal from './modal';
|
||||
|
||||
describe('<Modal />', () => {
|
||||
it('renders', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../jest/test-helpers';
|
||||
import ValidationCheckmark from '../validation-checkmark';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import ValidationCheckmark from './validation-checkmark';
|
||||
|
||||
describe('<ValidationCheckmark />', () => {
|
||||
it('renders text', () => {
|
|
@ -6,11 +6,11 @@ import {
|
|||
entitiesFetchSuccess,
|
||||
importEntities,
|
||||
incrementEntities,
|
||||
} from '../actions';
|
||||
import reducer, { State } from '../reducer';
|
||||
import { createListState } from '../utils';
|
||||
} from './actions';
|
||||
import reducer, { State } from './reducer';
|
||||
import { createListState } from './utils';
|
||||
|
||||
import type { EntityCache } from '../types';
|
||||
import type { EntityCache } from './types';
|
||||
|
||||
interface TestEntity {
|
||||
id: string;
|
|
@ -1,8 +1,9 @@
|
|||
import { Map as ImmutableMap } from 'immutable';
|
||||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import CaptchaField, { NativeCaptchaField } from '../captcha';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import CaptchaField, { NativeCaptchaField } from './captcha';
|
||||
|
||||
describe('<CaptchaField />', () => {
|
||||
it('renders null by default', () => {
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { fireEvent, render, screen } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeInstance } from 'soapbox/normalizers';
|
||||
|
||||
import { fireEvent, render, screen } from '../../../../jest/test-helpers';
|
||||
import LoginForm from '../login-form';
|
||||
import LoginForm from './login-form';
|
||||
|
||||
describe('<LoginForm />', () => {
|
||||
it('renders for Pleroma', () => {
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeInstance } from 'soapbox/normalizers';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import LoginPage from '../login-page';
|
||||
import LoginPage from './login-page';
|
||||
|
||||
describe('<LoginPage />', () => {
|
||||
it('renders correctly on load', () => {
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import OtpAuthForm from '../otp-auth-form';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import OtpAuthForm from './otp-auth-form';
|
||||
|
||||
describe('<OtpAuthForm />', () => {
|
||||
it('renders correctly', () => {
|
|
@ -2,9 +2,9 @@ import React from 'react';
|
|||
import { Route, Switch } from 'react-router-dom';
|
||||
|
||||
import { __stub } from 'soapbox/api';
|
||||
import { fireEvent, render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { fireEvent, render, screen, waitFor } from '../../../../jest/test-helpers';
|
||||
import PasswordResetConfirm from '../password-reset-confirm';
|
||||
import PasswordResetConfirm from './password-reset-confirm';
|
||||
|
||||
const TestableComponent = () => (
|
||||
<Switch>
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
import { IChat } from 'soapbox/queries/chats';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import ChatListItem from '../chat-list-item';
|
||||
import ChatListItem from './chat-list-item';
|
||||
|
||||
const chat: any = {
|
||||
id: '1',
|
|
@ -2,15 +2,15 @@ import userEvent from '@testing-library/user-event';
|
|||
import React from 'react';
|
||||
import { VirtuosoMockContext } from 'react-virtuoso';
|
||||
|
||||
import { __stub } from 'soapbox/api';
|
||||
import { ChatContext } from 'soapbox/contexts/chat-context';
|
||||
import { buildAccount, buildInstance } from 'soapbox/jest/factory';
|
||||
import { queryClient, render, rootState, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeChatMessage } from 'soapbox/normalizers';
|
||||
import { IChat } from 'soapbox/queries/chats';
|
||||
import { ChatMessage } from 'soapbox/types/entities';
|
||||
|
||||
import { __stub } from '../../../../api';
|
||||
import { queryClient, render, rootState, screen, waitFor } from '../../../../jest/test-helpers';
|
||||
import { IChat } from '../../../../queries/chats';
|
||||
import ChatMessageList from '../chat-message-list';
|
||||
import ChatMessageList from './chat-message-list';
|
||||
|
||||
const chat: IChat = {
|
||||
accepted: true,
|
|
@ -1,8 +1,9 @@
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import ChatMessageReaction from '../chat-message-reaction';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import ChatMessageReaction from './chat-message-reaction';
|
||||
|
||||
const emojiReaction = ({
|
||||
name: '👍',
|
|
@ -1,94 +0,0 @@
|
|||
test.skip('skip', () => {});
|
||||
|
||||
// import userEvent from '@testing-library/user-event';
|
||||
// import React from 'react';
|
||||
|
||||
// import { __stub } from 'soapbox/api';
|
||||
// import { buildAccount } from 'soapbox/jest/factory';
|
||||
// import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
// import ChatPage from '../chat-page';
|
||||
|
||||
// describe('<ChatPage />', () => {
|
||||
// let store: any;
|
||||
|
||||
// describe('before you finish onboarding', () => {
|
||||
// it('renders the Welcome component', () => {
|
||||
// render(<ChatPage />);
|
||||
|
||||
// expect(screen.getByTestId('chats-welcome')).toBeInTheDocument();
|
||||
// });
|
||||
|
||||
// describe('when you complete onboarding', () => {
|
||||
// const id = '1';
|
||||
|
||||
// beforeEach(() => {
|
||||
// store = {
|
||||
// me: id,
|
||||
// accounts: {
|
||||
// [id]: buildAccount({
|
||||
// id,
|
||||
// acct: 'justin-username',
|
||||
// display_name: 'Justin L',
|
||||
// avatar: 'test.jpg',
|
||||
// source: {
|
||||
// chats_onboarded: false,
|
||||
// },
|
||||
// }),
|
||||
// },
|
||||
// };
|
||||
|
||||
// __stub((mock) => {
|
||||
// mock
|
||||
// .onPatch('/api/v1/accounts/update_credentials')
|
||||
// .reply(200, { chats_onboarded: true, id });
|
||||
// });
|
||||
// });
|
||||
|
||||
// it('renders the Chats', async () => {
|
||||
// render(<ChatPage />, undefined, store);
|
||||
// await userEvent.click(screen.getByTestId('button'));
|
||||
|
||||
// expect(screen.getByTestId('chat-page')).toBeInTheDocument();
|
||||
|
||||
// await waitFor(() => {
|
||||
// expect(screen.getByTestId('toast')).toHaveTextContent('Chat Settings updated successfully');
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
// describe('when the API returns an error', () => {
|
||||
// beforeEach(() => {
|
||||
// store = {
|
||||
// me: '1',
|
||||
// accounts: {
|
||||
// '1': buildAccount({
|
||||
// id: '1',
|
||||
// acct: 'justin-username',
|
||||
// display_name: 'Justin L',
|
||||
// avatar: 'test.jpg',
|
||||
// source: {
|
||||
// chats_onboarded: false,
|
||||
// },
|
||||
// }),
|
||||
// },
|
||||
// };
|
||||
|
||||
// __stub((mock) => {
|
||||
// mock
|
||||
// .onPatch('/api/v1/accounts/update_credentials')
|
||||
// .networkError();
|
||||
// });
|
||||
// });
|
||||
|
||||
// it('renders the Chats', async () => {
|
||||
// render(<ChatPage />, undefined, store);
|
||||
// await userEvent.click(screen.getByTestId('button'));
|
||||
|
||||
// await waitFor(() => {
|
||||
// expect(screen.getByTestId('toast')).toHaveTextContent('Chat Settings failed to update.');
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
|
@ -1,8 +1,9 @@
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import ChatPaneHeader from '../chat-widget/chat-pane-header';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import ChatPaneHeader from './chat-widget/chat-pane-header';
|
||||
|
||||
describe('<ChatPaneHeader />', () => {
|
||||
it('handles the onToggle prop', async () => {
|
|
@ -7,7 +7,7 @@ import { StatProvider } from 'soapbox/contexts/stat-context';
|
|||
import chats from 'soapbox/jest/fixtures/chats.json';
|
||||
import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import ChatPane from '../chat-pane';
|
||||
import ChatPane from './chat-pane';
|
||||
|
||||
const renderComponentWithChatContext = (store = {}) => render(
|
||||
<VirtuosoMockContext.Provider value={{ viewportHeight: 300, itemHeight: 100 }}>
|
|
@ -4,9 +4,9 @@ import { VirtuosoMockContext } from 'react-virtuoso';
|
|||
|
||||
import { __stub } from 'soapbox/api';
|
||||
import { ChatProvider } from 'soapbox/contexts/chat-context';
|
||||
import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { render, screen, waitFor } from '../../../../../jest/test-helpers';
|
||||
import ChatSearch from '../chat-search';
|
||||
import ChatSearch from './chat-search';
|
||||
|
||||
const renderComponent = () => render(
|
||||
<VirtuosoMockContext.Provider value={{ viewportHeight: 300, itemHeight: 100 }}>
|
|
@ -2,9 +2,9 @@ import React from 'react';
|
|||
import { Route, Switch } from 'react-router-dom';
|
||||
|
||||
import { buildAccount } from 'soapbox/jest/factory';
|
||||
import { render, rootState } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { render, rootState } from '../../../../jest/test-helpers';
|
||||
import ChatWidget from '../chat-widget/chat-widget';
|
||||
import ChatWidget from './chat-widget/chat-widget';
|
||||
|
||||
const id = '1';
|
||||
const account = buildAccount({
|
|
@ -1,32 +0,0 @@
|
|||
test.skip('skip', () => {});
|
||||
|
||||
// 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('<Search />', () => {
|
||||
// it('successfully renders', async() => {
|
||||
// render(<Search autosuggest />);
|
||||
// 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(<Search autosuggest />);
|
||||
|
||||
// await user.type(screen.getByLabelText('Search'), '@jus');
|
||||
|
||||
// await waitFor(() => {
|
||||
// expect(screen.getByLabelText('Search')).toHaveValue('@jus');
|
||||
// expect(screen.getByTestId('account')).toBeInTheDocument();
|
||||
// });
|
||||
// });
|
||||
// });
|
|
@ -1,8 +1,9 @@
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { render, screen } from '../../../../../jest/test-helpers';
|
||||
import DurationSelector from '../duration-selector';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import DurationSelector from './duration-selector';
|
||||
|
||||
describe('<DurationSelector />', () => {
|
||||
it('defaults to 2 days', () => {
|
|
@ -1,4 +1,4 @@
|
|||
import emojify from '../index';
|
||||
import emojify from '.';
|
||||
|
||||
describe('emoji', () => {
|
||||
describe('.emojify', () => {
|
|
@ -1,7 +1,7 @@
|
|||
import { List, Map } from 'immutable';
|
||||
import pick from 'lodash/pick';
|
||||
|
||||
import search, { addCustomToPool } from '../search';
|
||||
import search, { addCustomToPool } from './search';
|
||||
|
||||
const trimEmojis = (emoji: any) => pick(emoji, ['id', 'unified', 'native', 'custom']);
|
||||
|
|
@ -5,7 +5,7 @@ import { render, screen } from 'soapbox/jest/test-helpers';
|
|||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
import { Group } from 'soapbox/types/entities';
|
||||
|
||||
import GroupActionButton from '../group-action-button';
|
||||
import GroupActionButton from './group-action-button';
|
||||
|
||||
let group: Group;
|
||||
|
|
@ -4,7 +4,7 @@ import { buildGroup } from 'soapbox/jest/factory';
|
|||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
import { Group } from 'soapbox/types/entities';
|
||||
|
||||
import GroupHeader from '../group-header';
|
||||
import GroupHeader from './group-header';
|
||||
|
||||
let group: Group;
|
||||
|
|
@ -4,7 +4,7 @@ import { buildGroup } from 'soapbox/jest/factory';
|
|||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
import { Group } from 'soapbox/types/entities';
|
||||
|
||||
import GroupMemberCount from '../group-member-count';
|
||||
import GroupMemberCount from './group-member-count';
|
||||
|
||||
let group: Group;
|
||||
|
|
@ -6,7 +6,7 @@ import { buildGroup, buildGroupMember, buildGroupRelationship } from 'soapbox/je
|
|||
import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
|
||||
import GroupMemberListItem from '../group-member-list-item';
|
||||
import GroupMemberListItem from './group-member-list-item';
|
||||
|
||||
describe('<GroupMemberListItem />', () => {
|
||||
describe('account rendering', () => {
|
|
@ -5,7 +5,7 @@ import { render, screen } from 'soapbox/jest/test-helpers';
|
|||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
import { Group } from 'soapbox/types/entities';
|
||||
|
||||
import GroupOptionsButton from '../group-options-button';
|
||||
import GroupOptionsButton from './group-options-button';
|
||||
|
||||
let group: Group;
|
||||
|
|
@ -4,7 +4,7 @@ import { buildGroup } from 'soapbox/jest/factory';
|
|||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
import { Group } from 'soapbox/types/entities';
|
||||
|
||||
import GroupPrivacy from '../group-privacy';
|
||||
import GroupPrivacy from './group-privacy';
|
||||
|
||||
let group: Group;
|
||||
|
|
@ -5,7 +5,7 @@ import { render, screen } from 'soapbox/jest/test-helpers';
|
|||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
import { Group } from 'soapbox/types/entities';
|
||||
|
||||
import GroupRelationship from '../group-relationship';
|
||||
import GroupRelationship from './group-relationship';
|
||||
|
||||
let group: Group;
|
||||
|
|
@ -4,7 +4,7 @@ import { buildGroup, buildGroupTag, buildGroupRelationship } from 'soapbox/jest/
|
|||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
import { GroupRoles } from 'soapbox/schemas/group-member';
|
||||
|
||||
import GroupTagListItem from '../group-tag-list-item';
|
||||
import GroupTagListItem from './group-tag-list-item';
|
||||
|
||||
describe('<GroupTagListItem />', () => {
|
||||
describe('tag name', () => {
|
|
@ -1,87 +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 PendingRequests from '../pending-requests';
|
||||
|
||||
// const userId = '1';
|
||||
// const store: any = {
|
||||
// me: userId,
|
||||
// accounts: {
|
||||
// [userId]: buildAccount({
|
||||
// id: userId,
|
||||
// acct: 'justin-username',
|
||||
// display_name: 'Justin L',
|
||||
// avatar: 'test.jpg',
|
||||
// source: {
|
||||
// chats_onboarded: false,
|
||||
// },
|
||||
// }),
|
||||
// },
|
||||
// instance: normalizeInstance({
|
||||
// version: '3.4.1 (compatible; TruthSocial 1.0.0)',
|
||||
// }),
|
||||
// };
|
||||
|
||||
// const renderApp = () => (
|
||||
// render(
|
||||
// <VirtuosoMockContext.Provider value={{ viewportHeight: 300, itemHeight: 100 }}>
|
||||
// <PendingRequests />
|
||||
// </VirtuosoMockContext.Provider>,
|
||||
// undefined,
|
||||
// store,
|
||||
// )
|
||||
// );
|
||||
|
||||
// describe('<PendingRequests />', () => {
|
||||
// describe('without pending group requests', () => {
|
||||
// beforeEach(() => {
|
||||
// __stub((mock) => {
|
||||
// mock.onGet('/api/v1/groups?pending=true').reply(200, []);
|
||||
// });
|
||||
// });
|
||||
|
||||
// it('should render the blankslate', async () => {
|
||||
// renderApp();
|
||||
|
||||
// await waitFor(() => {
|
||||
// expect(screen.getByTestId('pending-requests-blankslate')).toBeInTheDocument();
|
||||
// expect(screen.queryAllByTestId('group-card')).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 groups', async () => {
|
||||
// renderApp();
|
||||
|
||||
// await waitFor(() => {
|
||||
// expect(screen.queryAllByTestId('group-card')).toHaveLength(1);
|
||||
// expect(screen.queryAllByTestId('pending-requests-blankslate')).toHaveLength(0);
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
|
@ -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);
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
|
@ -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', () => {
|
|
@ -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', () => {
|
|
@ -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', () => {
|
|
@ -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();
|
||||
// });
|
||||
// });
|
||||
// });
|
|
@ -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 />', () => {
|
|
@ -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 = {
|
|
@ -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({
|
|
@ -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', () => {
|
|
@ -5,7 +5,7 @@ import { buildAccount } from 'soapbox/jest/factory';
|
|||
import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeInstance } from 'soapbox/normalizers';
|
||||
|
||||
import Discover from '../discover';
|
||||
import Discover from './discover';
|
||||
|
||||
vi.mock('../../../hooks/useDimensions', () => ({
|
||||
useDimensions: () => [{ scrollWidth: 190 }, null, { width: 300 }],
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { updateNotifications } from 'soapbox/actions/notifications';
|
||||
import { render, screen, rootState, createTestStore } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Notification from '../notification';
|
||||
import Notification from './notification';
|
||||
|
||||
/** Prepare the notification for use by the component */
|
||||
const normalize = (notification: any) => {
|
|
@ -7,7 +7,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|||
import { MODAL_CLOSE, MODAL_OPEN } from 'soapbox/actions/modals';
|
||||
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import ComposeButton from '../compose-button';
|
||||
import ComposeButton from './compose-button';
|
||||
|
||||
const store = mockStore(rootState);
|
||||
const renderComposeButton = () => {
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import { storeClosed, storeLoggedIn, storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import CtaBanner from '../cta-banner';
|
||||
import CtaBanner from './cta-banner';
|
||||
|
||||
describe('<CtaBanner />', () => {
|
||||
it('renders the banner', () => {
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import LandingPageModal from '../landing-page-modal';
|
||||
import LandingPageModal from './landing-page-modal';
|
||||
|
||||
describe('<LandingPageModal />', () => {
|
||||
it('successfully renders', () => {
|
|
@ -1,77 +0,0 @@
|
|||
test.skip('skip', () => {});
|
||||
|
||||
// import userEvent from '@testing-library/user-event';
|
||||
// import { Map as ImmutableMap, Record as ImmutableRecord, Set as ImmutableSet } from 'immutable';
|
||||
// import React from 'react';
|
||||
|
||||
// import { ReportableEntities } from 'soapbox/actions/reports';
|
||||
// import { __stub } from 'soapbox/api';
|
||||
// import { buildAccount } from 'soapbox/jest/factory';
|
||||
// import { render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
// import { normalizeStatus } from 'soapbox/normalizers';
|
||||
|
||||
// import ReportModal from '../report-modal';
|
||||
|
||||
// describe('<ReportModal />', () => {
|
||||
// let store: any;
|
||||
|
||||
// beforeEach(() => {
|
||||
// const rules = require('soapbox/__fixtures__/rules.json');
|
||||
// const status = require('soapbox/__fixtures__/status-unordered-mentions.json');
|
||||
|
||||
// store = {
|
||||
// accounts: {
|
||||
// '1': buildAccount({
|
||||
// id: '1',
|
||||
// acct: 'username',
|
||||
// display_name: 'My name',
|
||||
// avatar: 'test.jpg',
|
||||
// }),
|
||||
// },
|
||||
// reports: ImmutableRecord({
|
||||
// new: ImmutableRecord({
|
||||
// account_id: '1',
|
||||
// status_ids: ImmutableSet(['1']),
|
||||
// rule_ids: ImmutableSet(),
|
||||
// entityType: ReportableEntities.STATUS,
|
||||
// })(),
|
||||
// })(),
|
||||
// statuses: ImmutableMap({
|
||||
// '1': normalizeStatus(status),
|
||||
// }),
|
||||
// rules: {
|
||||
// items: rules,
|
||||
// },
|
||||
// };
|
||||
|
||||
// __stub(mock => {
|
||||
// mock.onGet('/api/v1/instance/rules').reply(200, rules);
|
||||
// mock.onPost('/api/v1/reports').reply(200, {});
|
||||
// });
|
||||
// });
|
||||
|
||||
// it('successfully renders the first step', () => {
|
||||
// render(<ReportModal onClose={vi.fn} />, {}, store);
|
||||
// expect(screen.getByText('Reason for reporting')).toBeInTheDocument();
|
||||
// });
|
||||
|
||||
// it('successfully moves to the second step', async() => {
|
||||
// const user = userEvent.setup();
|
||||
// render(<ReportModal onClose={vi.fn} />, {}, store);
|
||||
// await user.click(screen.getByTestId('rule-1'));
|
||||
// await user.click(screen.getByText('Next'));
|
||||
// expect(screen.getByText(/Further actions:/)).toBeInTheDocument();
|
||||
// });
|
||||
|
||||
// it('successfully moves to the third step', async() => {
|
||||
// const user = userEvent.setup();
|
||||
// render(<ReportModal onClose={vi.fn} />, {}, store);
|
||||
// await user.click(screen.getByTestId('rule-1'));
|
||||
// await user.click(screen.getByText(/Next/));
|
||||
// await user.click(screen.getByText(/Submit/));
|
||||
|
||||
// await waitFor(() => {
|
||||
// expect(screen.getByText(/Thanks for submitting your report/)).toBeInTheDocument();
|
||||
// });
|
||||
// });
|
||||
// });
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import UnauthorizedModal from '../unauthorized-modal';
|
||||
import UnauthorizedModal from './unauthorized-modal';
|
||||
|
||||
describe('<UnauthorizedModal />', () => {
|
||||
it('successfully renders', () => {
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Navbar from '../navbar';
|
||||
import Navbar from './navbar';
|
||||
|
||||
describe('<Navbar />', () => {
|
||||
it('successfully renders', () => {
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import SignUpPanel from '../sign-up-panel';
|
||||
import SignUpPanel from './sign-up-panel';
|
||||
|
||||
describe('<SignUpPanel />', () => {
|
||||
it('doesn\'t render by default', () => {
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { buildAccount, buildRelationship } from 'soapbox/jest/factory';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import SubscribeButton from '../subscription-button';
|
||||
import SubscribeButton from './subscription-button';
|
||||
|
||||
const justin = {
|
||||
id: '1',
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { __stub } from 'soapbox/api';
|
||||
import { queryClient, render, screen, waitFor } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import TrendsPanel from '../trends-panel';
|
||||
import TrendsPanel from './trends-panel';
|
||||
|
||||
describe('<TrendsPanel />', () => {
|
||||
beforeEach(() => {
|
|
@ -1,7 +1,7 @@
|
|||
import { renderHook, act } from '@testing-library/react-hooks';
|
||||
|
||||
import { listener, mockDisconnect } from '../__mocks__/resize-observer';
|
||||
import { useDimensions } from '../useDimensions';
|
||||
import { listener, mockDisconnect } from './__mocks__/resize-observer';
|
||||
import { useDimensions } from './useDimensions';
|
||||
|
||||
describe('useDimensions()', () => {
|
||||
beforeEach(() => {
|
|
@ -3,7 +3,7 @@ import { buildAccount, buildGroup, buildGroupRelationship } from 'soapbox/jest/f
|
|||
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
|
||||
import { normalizeInstance } from 'soapbox/normalizers';
|
||||
|
||||
import { useGroupsPath } from '../useGroupsPath';
|
||||
import { useGroupsPath } from './useGroupsPath';
|
||||
|
||||
describe('useGroupsPath()', () => {
|
||||
test('without the groupsDiscovery feature', () => {
|
|
@ -1,6 +1,6 @@
|
|||
import { Record as ImmutableRecord, fromJS } from 'immutable';
|
||||
|
||||
import { normalizeAccount } from '../account';
|
||||
import { normalizeAccount } from './account';
|
||||
|
||||
const AVATAR_MISSING = require('soapbox/assets/images/avatar-missing.png');
|
||||
const HEADER_MISSING = require('soapbox/assets/images/header-missing.png');
|
|
@ -1,6 +1,6 @@
|
|||
import { Record as ImmutableRecord } from 'immutable';
|
||||
|
||||
import { normalizeAttachment } from '../attachment';
|
||||
import { normalizeAttachment } from './attachment';
|
||||
|
||||
describe('normalizeAttachment()', () => {
|
||||
it('adds base fields', () => {
|
|
@ -1,7 +1,7 @@
|
|||
import { Record as ImmutableRecord } from 'immutable';
|
||||
|
||||
import { normalizeAttachment } from '../attachment';
|
||||
import { normalizeChatMessage } from '../chat-message';
|
||||
import { normalizeAttachment } from './attachment';
|
||||
import { normalizeChatMessage } from './chat-message';
|
||||
|
||||
describe('normalizeChatMessage()', () => {
|
||||
it('upgrades attachment to media_attachments', () => {
|
|
@ -1,6 +1,6 @@
|
|||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||
|
||||
import { normalizeInstance } from '../instance';
|
||||
import { normalizeInstance } from './instance';
|
||||
|
||||
describe('normalizeInstance()', () => {
|
||||
it('normalizes an empty Map', () => {
|
|
@ -1,6 +1,6 @@
|
|||
import { Record as ImmutableRecord } from 'immutable';
|
||||
|
||||
import { normalizeMention } from '../mention';
|
||||
import { normalizeMention } from './mention';
|
||||
|
||||
describe('normalizeMention()', () => {
|
||||
it('adds base fields', () => {
|
|
@ -1,6 +1,6 @@
|
|||
import { Record as ImmutableRecord } from 'immutable';
|
||||
|
||||
import { normalizeNotification } from '../notification';
|
||||
import { normalizeNotification } from './notification';
|
||||
|
||||
describe('normalizeNotification()', () => {
|
||||
it('normalizes an empty map', () => {
|
|
@ -1,6 +1,6 @@
|
|||
import { Record as ImmutableRecord } from 'immutable';
|
||||
|
||||
import { normalizeSoapboxConfig } from '../soapbox-config';
|
||||
import { normalizeSoapboxConfig } from './soapbox-config';
|
||||
|
||||
describe('normalizeSoapboxConfig()', () => {
|
||||
it('adds base fields', () => {
|
|
@ -1,6 +1,6 @@
|
|||
import { Record as ImmutableRecord, fromJS } from 'immutable';
|
||||
|
||||
import { normalizeStatus } from '../status';
|
||||
import { normalizeStatus } from './status';
|
||||
|
||||
import type { Poll, Card } from 'soapbox/types/entities';
|
||||
|
|
@ -10,7 +10,7 @@ import { Store } from 'soapbox/store';
|
|||
import { ChatMessage } from 'soapbox/types/entities';
|
||||
import { flattenPages } from 'soapbox/utils/queries';
|
||||
|
||||
import { ChatKeys, IChat, isLastMessage, useChat, useChatActions, useChatMessages, useChats } from '../chats';
|
||||
import { ChatKeys, IChat, isLastMessage, useChat, useChatActions, useChatMessages, useChats } from './chats';
|
||||
|
||||
const chat: IChat = {
|
||||
accepted: true,
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue