Re-export all React Testing Library functions (#23522)

Этот коммит содержится в:
Harrison Healey
2023-06-05 12:49:31 -04:00
коммит произвёл GitHub
родитель f4f420dd93
Коммит 9c656c25d9
96 изменённых файлов: 282 добавлений и 322 удалений

Просмотреть файл

@@ -2,21 +2,16 @@
// See LICENSE.txt for license information.
import React from 'react';
import {Provider} from 'react-redux';
import mockStore from 'tests/test_store';
import {ClientConfig, ClientLicense} from '@mattermost/types/config';
import AboutBuildModal from 'components/about_build_modal/about_build_modal';
import {renderWithFullContext, screen, userEvent} from 'tests/react_testing_utils';
import {AboutLinks} from 'utils/constants';
import AboutBuildModalCloud from './about_build_modal_cloud/about_build_modal_cloud';
import {screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import store from 'stores/redux_store';
import userEvent from '@testing-library/user-event';
describe('components/AboutBuildModal', () => {
const RealDate: DateConstructor = Date;
@@ -98,16 +93,14 @@ describe('components/AboutBuildModal', () => {
license.Cloud = 'true';
}
renderWithIntl(
<Provider store={store}>
<AboutBuildModalCloud
config={config}
license={license}
show={true}
onExited={jest.fn()}
doHide={jest.fn()}
/>
</Provider>,
renderWithFullContext(
<AboutBuildModalCloud
config={config}
license={license}
show={true}
onExited={jest.fn()}
doHide={jest.fn()}
/>,
);
expect(screen.getByText('Mattermost Cloud')).toBeInTheDocument();
@@ -170,7 +163,7 @@ describe('components/AboutBuildModal', () => {
test('should call onExited callback when the modal is hidden', () => {
const onExited = jest.fn();
const store = mockStore({
const state = {
entities: {
general: {
config: {},
@@ -182,16 +175,15 @@ describe('components/AboutBuildModal', () => {
currentUserId: 'currentUserId',
},
},
});
};
renderWithIntl(
<Provider store={store}>
<AboutBuildModal
config={config}
license={license}
onExited={onExited}
/>
</Provider>,
renderWithFullContext(
<AboutBuildModal
config={config}
license={license}
onExited={onExited}
/>,
state,
);
userEvent.click(screen.getByText('Close'));
@@ -199,7 +191,7 @@ describe('components/AboutBuildModal', () => {
});
test('should show default tos and privacy policy links and not the config links', () => {
const store = mockStore({
const state = {
entities: {
general: {
config: {},
@@ -211,15 +203,14 @@ describe('components/AboutBuildModal', () => {
currentUserId: 'currentUserId',
},
},
});
renderWithIntl(
<Provider store={store}>
<AboutBuildModal
config={config}
license={license}
onExited={jest.fn()}
/>
</Provider>,
};
renderWithFullContext(
<AboutBuildModal
config={config}
license={license}
onExited={jest.fn()}
/>,
state,
);
expect(screen.getByRole('link', {name: 'Terms of Use'})).toHaveAttribute('href', `${AboutLinks.TERMS_OF_SERVICE}?utm_source=mattermost&utm_medium=in-product&utm_content=about_build_modal&uid=currentUserId&sid=`);
@@ -242,6 +233,6 @@ describe('components/AboutBuildModal', () => {
...props,
};
return renderWithIntl(<Provider store={store}><AboutBuildModal {...allProps}/></Provider>);
return renderWithFullContext(<AboutBuildModal {...allProps}/>);
}
});

Просмотреть файл

@@ -2,14 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {Provider} from 'react-redux';
import {BrowserRouter} from 'react-router-dom';
import {screen} from '@testing-library/react';
import mockStore from 'tests/test_store';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithFullContext, screen} from 'tests/react_testing_utils';
import InsightsTitle from './insights_title';
@@ -31,53 +25,33 @@ describe('components/activity_and_insights/insights/insights_title', () => {
},
},
},
general: {
config: {},
license: {},
},
users: {
currentUserId: 'current_user_id',
profiles: {
current_user_id: {},
},
},
preferences: {
myPreferences: {},
},
cloud: {
subscription: {},
},
},
};
test('should match snapshot with My insights', async () => {
const store = await mockStore(initialState);
renderWithIntl(
<Provider store={store}>
<BrowserRouter>
<InsightsTitle
{...props}
filterType={'MY'}
/>
</BrowserRouter>
</Provider>,
test('should match snapshot with My insights', () => {
renderWithFullContext(
<InsightsTitle
{...props}
filterType={'MY'}
/>,
initialState,
);
expect(screen.getByText('My insights')).toBeInTheDocument();
});
test('should match snapshot with Team insights', async () => {
const store = await mockStore(initialState);
renderWithIntl(
<Provider store={store}>
<BrowserRouter>
<InsightsTitle
{...props}
/>
</BrowserRouter>
</Provider>,
test('should match snapshot with Team insights', () => {
renderWithFullContext(
<InsightsTitle
{...props}
/>,
initialState,
);
expect(screen.getByText('Team insights')).toBeInTheDocument();

Просмотреть файл

@@ -5,12 +5,11 @@ import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
import {act} from 'tests/react_testing_utils';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import mockStore from 'tests/test_store';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import LeastActiveChannels from './least_active_channels';

Просмотреть файл

@@ -4,14 +4,13 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
import {TimeFrames} from '@mattermost/types/insights';
import {act} from 'tests/react_testing_utils';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import mockStore from 'tests/test_store';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopBoards from './top_boards';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopBoardsTable from './top_boards_table';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopChannels from './top_channels';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopChannelsTable from './top_channels_table';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import NewMembersTable from './new_members_table';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopDMsAndNewMembers from './top_dms_and_new_members';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopDMsTable from './top_dms_table';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopPlaybooks from './top_playbooks';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopPlaybooksTable from './top_playbooks_table';

Просмотреть файл

@@ -4,13 +4,12 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopReactions from './top_reactions';

Просмотреть файл

@@ -4,13 +4,12 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopReactionsTable from './top_reactions_table';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopThreads from './top_threads';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {PostType} from '@mattermost/types/posts';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopThreadsItem from './top_threads_item';

Просмотреть файл

@@ -4,8 +4,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -13,6 +11,7 @@ import {BrowserRouter} from 'react-router-dom';
import {TimeFrames} from '@mattermost/types/insights';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import TopThreadsTable from './top_threads_table';

Просмотреть файл

@@ -2,16 +2,15 @@
// See LICENSE.txt for license information.
import React, {ComponentType} from 'react';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
import {InsightsScopes} from 'utils/constants';
import {CardSizes, InsightsWidgetTypes, TimeFrames} from '@mattermost/types/insights';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {InsightsScopes} from 'utils/constants';
import widgetHoc from './widget_hoc';
describe('components/activity_and_insights/insights/widget_hoc', () => {

Просмотреть файл

@@ -3,25 +3,17 @@
import React from 'react';
import {screen} from '@testing-library/react';
import {renderWithFullContext, screen} from 'tests/react_testing_utils';
import {MenuItemBlockableLinkImpl} from './menu_item_blockable_link';
import {renderWithIntl} from 'tests/react_testing_utils';
import {Provider} from 'react-redux';
import store from 'stores/redux_store';
import {BrowserRouter} from 'react-router-dom';
describe('components/MenuItemBlockableLink', () => {
test('should render my link', () => {
renderWithIntl(
<BrowserRouter>
<Provider store={store}>
<MenuItemBlockableLinkImpl
to='/wherever'
text='Whatever'
/>
</Provider>
</BrowserRouter>,
renderWithFullContext(
<MenuItemBlockableLinkImpl
to='/wherever'
text='Whatever'
/>,
);
screen.getByText('Whatever');

Просмотреть файл

@@ -3,12 +3,11 @@
import React from 'react';
import {screen} from '@testing-library/react';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
import AdminUserCard from 'components/admin_console/admin_user_card/admin_user_card';
import {renderWithIntl} from 'tests/react_testing_utils';
import AdminUserCard from './admin_user_card';
describe('components/admin_console/admin_user_card/admin_user_card', () => {
const user = TestHelper.getUserMock({

Просмотреть файл

@@ -5,9 +5,7 @@ import React from 'react';
import {Provider} from 'react-redux';
import {screen} from '@testing-library/react';
import {renderWithIntl, renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntl, renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {CloudLinks, HostedCustomerLinks} from 'utils/constants';

Просмотреть файл

@@ -2,9 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen, fireEvent} from '@testing-library/react';
import {Provider} from 'react-redux';
import {GlobalState} from '@mattermost/types/store';
import {UserProfile, UsersState} from '@mattermost/types/users';
import {getPreferenceKey} from 'mattermost-redux/utils/preference_utils';
import {Preferences} from 'mattermost-redux/constants';
@@ -14,14 +14,11 @@ import * as useGetUsageDeltas from 'components/common/hooks/useGetUsageDeltas';
import * as useOpenCloudPurchaseModal from 'components/common/hooks/useOpenCloudPurchaseModal';
import * as useOpenPricingModal from 'components/common/hooks/useOpenPricingModal';
import * as useSaveBool from 'components/common/hooks/useSavePreferences';
import {renderWithIntl} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {fireEvent, renderWithFullContext, screen} from 'tests/react_testing_utils';
import {CloudProducts} from 'utils/constants';
import {GlobalState} from '@mattermost/types/store';
import {UserProfile, UsersState} from '@mattermost/types/users';
import LimitReachedBanner from './limit_reached_banner';
const upgradeCloudKey = getPreferenceKey(Preferences.CATEGORY_UPGRADE_CLOUD, Preferences.SYSTEM_CONSOLE_LIMIT_REACHED);
@@ -120,11 +117,11 @@ function makeSpies() {
describe('limits_reached_banner', () => {
test('does not render when product is enterprise', () => {
const store = mockStore(state);
const spies = makeSpies();
spies.useGetUsageDeltas.mockReturnValue(someLimitReached);
renderWithIntl(<Provider store={store}><LimitReachedBanner product={enterprise}/></Provider>);
renderWithFullContext(<LimitReachedBanner product={enterprise}/>, state);
expect(screen.queryByText(titleFree)).not.toBeInTheDocument();
expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument();
});
@@ -143,46 +140,55 @@ describe('limits_reached_banner', () => {
},
},
};
const store = mockStore(myState);
const spies = makeSpies();
spies.useGetUsageDeltas.mockReturnValue(someLimitReached);
renderWithIntl(<Provider store={store}><LimitReachedBanner product={enterprise}/></Provider>);
renderWithFullContext(<LimitReachedBanner product={enterprise}/>, myState);
expect(screen.queryByText(titleFree)).not.toBeInTheDocument();
expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument();
});
test('does not render when no limit reached', () => {
const store = mockStore(state);
const spies = makeSpies();
spies.useGetUsageDeltas.mockReturnValue(noLimitReached);
renderWithIntl(<Provider store={store}><LimitReachedBanner product={free}/></Provider>);
renderWithFullContext(<LimitReachedBanner product={free}/>, state);
expect(screen.queryByText(titleFree)).not.toBeInTheDocument();
expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument();
});
test('renders free banner', () => {
const store = mockStore(state);
const spies = makeSpies();
const mockOpenPricingModal = jest.fn();
spies.useOpenPricingModal.mockReturnValue(mockOpenPricingModal);
spies.useGetUsageDeltas.mockReturnValue(someLimitReached);
renderWithIntl(<Provider store={store}><LimitReachedBanner product={free}/></Provider>);
renderWithFullContext(<LimitReachedBanner product={free}/>, state);
screen.getByText(titleFree);
expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument();
fireEvent.click(screen.getByText('View plans'));
expect(mockOpenPricingModal).toHaveBeenCalled();
});
test('clicking Contact Sales opens sales link', () => {
const store = mockStore(state);
const spies = makeSpies();
const mockOpenSalesLink = jest.fn();
spies.useOpenSalesLink.mockReturnValue([mockOpenSalesLink, '']);
spies.useGetUsageDeltas.mockReturnValue(someLimitReached);
renderWithIntl(<Provider store={store}><LimitReachedBanner product={free}/></Provider>);
renderWithFullContext(<LimitReachedBanner product={free}/>, state);
screen.getByText(titleFree);
expect(screen.queryByText(titleProfessional)).not.toBeInTheDocument();
fireEvent.click(screen.getByText('Contact sales'));
expect(mockOpenSalesLink).toHaveBeenCalled();
});
});

Просмотреть файл

@@ -3,12 +3,10 @@
import React from 'react';
import {screen} from '@testing-library/react';
import * as redux from 'react-redux';
import {Provider} from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import * as cloudActions from 'actions/cloud';

Просмотреть файл

@@ -2,9 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {CloudProducts} from 'utils/constants';
import {ToPaidNudgeBanner, ToPaidPlanBannerDismissable} from './to_paid_plan_nudge_banner';

Просмотреть файл

@@ -2,9 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {CloudProducts, RecurringIntervals} from 'utils/constants';
import {ToYearlyNudgeBanner, ToYearlyNudgeBannerDismissable} from './to_yearly_nudge_banner';

Просмотреть файл

@@ -3,9 +3,9 @@
import React from 'react';
import ColorSetting from 'components/admin_console/color_setting';
import {renderWithIntl} from 'tests/react_testing_utils';
import {screen} from '@testing-library/react';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import ColorSetting from './color_setting';
describe('components/ColorSetting', () => {
test('should match snapshot, all', () => {

Просмотреть файл

@@ -2,17 +2,22 @@
// See LICENSE.txt for license information.
import React from 'react';
import {Provider as ReduxProvider} from 'react-redux';
import FeatureDiscovery from 'components/admin_console/feature_discovery/feature_discovery';
import store from 'stores/redux_store';
import {
renderWithIntl,
screen,
userEvent,
waitFor,
} from 'tests/react_testing_utils';
import {LicenseSkus} from 'utils/constants';
import SamlSVG from './features/images/saml_svg';
import {renderWithIntl} from 'tests/react_testing_utils';
import {screen, waitFor} from '@testing-library/react';
import {Provider as ReduxProvider} from 'react-redux';
import store from 'stores/redux_store';
import userEvent from '@testing-library/user-event';
describe('components/feature_discovery', () => {
describe('FeatureDiscovery', () => {

Просмотреть файл

@@ -2,14 +2,13 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
import moment from 'moment-timezone';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import {OverActiveUserLimits, SelfHostedProducts} from 'utils/constants';
import {TestHelper} from 'utils/test_helper';

Просмотреть файл

@@ -3,9 +3,9 @@
import React from 'react';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import AdminTextSetting from './text_setting';
import {renderWithIntl} from 'tests/react_testing_utils';
import {screen} from '@testing-library/react';
describe('components/admin_console/TextSetting', () => {
test('render component with required props', () => {

Просмотреть файл

@@ -2,12 +2,11 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {GlobalState} from '@mattermost/types/store';
import {DeepPartial} from '@mattermost/types/utilities';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import * as useCWSAvailabilityCheckAll from 'components/common/hooks/useCWSAvailabilityCheck';
import {LicenseSkus} from 'utils/constants';

Просмотреть файл

@@ -2,11 +2,15 @@
// See LICENSE.txt for license information.
import React, {ComponentProps} from 'react';
import {fireEvent, screen, waitFor} from '@testing-library/react';
import * as reactRedux from 'react-redux';
import configureStore from 'store';
import {renderWithIntl} from 'tests/react_testing_utils';
import {
fireEvent,
renderWithIntl,
screen,
waitFor,
} from 'tests/react_testing_utils';
import {CloudProducts, Preferences, TELEMETRY_CATEGORIES} from 'utils/constants';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {Client4} from 'mattermost-redux/client';

Просмотреть файл

@@ -2,13 +2,12 @@
// See LICENSE.txt for license information.
import React from 'react';
import {fireEvent, screen} from '@testing-library/react';
import {DeepPartial} from '@mattermost/types/utilities';
import {GlobalState} from 'types/store';
import {General} from 'mattermost-redux/constants';
import {OverActiveUserLimits, Preferences, SelfHostedProducts, StatTypes} from 'utils/constants';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {trackEvent} from 'actions/telemetry_actions';
import {getLicenseSelfServeStatus} from 'mattermost-redux/actions/cloud';

Просмотреть файл

@@ -2,8 +2,7 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import * as cloudActions from 'mattermost-redux/actions/cloud';
import {CloudProducts} from 'utils/constants';

Просмотреть файл

@@ -3,10 +3,9 @@
import React from 'react';
import {Provider} from 'react-redux';
import {screen} from '@testing-library/react';
import {makeEmptyUsage} from 'utils/limits_test';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import testConfigureStore from 'tests/test_store';
import {adminUsersState, endUsersState} from 'tests/constants/users';
import {emptyLimits} from 'tests/constants/cloud';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {Channel} from '@mattermost/types/channels';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import Constants from 'utils/constants';
import {Channel} from '@mattermost/types/channels';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {Channel} from '@mattermost/types/channels';
import {UserProfile} from '@mattermost/types/users';

Просмотреть файл

@@ -3,9 +3,7 @@
import React from 'react';
import {act} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {act, renderWithIntl} from 'tests/react_testing_utils';
import {Channel, ChannelStats} from '@mattermost/types/channels';
import {UserProfile} from '@mattermost/types/users';

Просмотреть файл

@@ -2,9 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {fireEvent, screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntl, screen} from 'tests/react_testing_utils';
import EditableArea from './editable_area';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import {fireEvent, screen} from '@testing-library/react';
import {Channel} from '@mattermost/types/channels';
import {renderWithIntl} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntl, screen} from 'tests/react_testing_utils';
import Header from './header';

Просмотреть файл

@@ -2,9 +2,13 @@
// See LICENSE.txt for license information.
import React from 'react';
import {act, fireEvent, screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {
act,
fireEvent,
renderWithIntl,
screen,
} from 'tests/react_testing_utils';
import Constants from 'utils/constants';
import {Channel, ChannelStats} from '@mattermost/types/channels';

Просмотреть файл

@@ -2,9 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {fireEvent, screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntl, screen} from 'tests/react_testing_utils';
import Constants from 'utils/constants';
import TopButtons, {Props} from './top_buttons';

Просмотреть файл

@@ -2,9 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {fireEvent, screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntl, screen} from 'tests/react_testing_utils';
import Constants from 'utils/constants';
import ActionBar, {Props} from './action_bar';

Просмотреть файл

@@ -3,12 +3,10 @@
import React from 'react';
import {screen} from '@testing-library/react';
import * as redux from 'react-redux';
import {Provider} from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {FileSizes} from 'utils/file_utils';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React, {ReactPortal} from 'react';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
import {Preferences} from 'utils/constants';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React, {ComponentProps} from 'react';
import {fireEvent, screen} from '@testing-library/react';
import * as reactRedux from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntl, screen} from 'tests/react_testing_utils';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {trackEvent} from 'actions/telemetry_actions';
import configureStore from 'store';

Просмотреть файл

@@ -2,7 +2,6 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import * as reactRedux from 'react-redux';
import {CloudProducts, ModalIdentifiers, Preferences} from 'utils/constants';
@@ -10,7 +9,7 @@ import * as StorageSelectors from 'selectors/storage';
import configureStore from 'store';
import {TestHelper} from 'utils/test_helper';
import ModalController from 'components/modal_controller';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import * as cloudActions from 'mattermost-redux/actions/cloud';
import DelinquencyModalController from './index';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React, {ComponentProps} from 'react';
import {fireEvent, screen} from '@testing-library/react';
import * as reactRedux from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntl, screen} from 'tests/react_testing_utils';
import {trackEvent} from 'actions/telemetry_actions';
import configureStore from 'store';
import {ModalIdentifiers, TELEMETRY_CATEGORIES} from 'utils/constants';

Просмотреть файл

@@ -2,12 +2,11 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen, fireEvent} from '@testing-library/react';
import {shallowWithIntl} from 'tests/helpers/intl-test-helper';
import {Locations} from 'utils/constants';
import {TestHelper} from 'utils/test_helper';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {GlobalState} from 'types/store';
import {DeepPartial} from '@mattermost/types/utilities';

Просмотреть файл

@@ -2,12 +2,13 @@
// See LICENSE.txt for license information.
import React from 'react';
import {render, screen} from '@testing-library/react';
import {IntlProvider} from 'react-intl';
import {render, screen} from 'tests/react_testing_utils';
import EmojiMap from 'utils/emoji_map';
import EmojiPicker from 'components/emoji_picker/emoji_picker';
import EmojiPicker from './emoji_picker';
jest.mock('components/emoji_picker/components/emoji_picker_skin', () => () => (
<div/>

Просмотреть файл

@@ -2,12 +2,11 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {BrowserRouter} from 'react-router-dom';
import {GlobalState} from '@mattermost/types/store';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {ErrorPageTypes} from 'utils/constants';

Просмотреть файл

@@ -3,7 +3,6 @@
import React from 'react';
import {mount} from 'enzyme';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
@@ -11,7 +10,7 @@ import {DeepPartial} from 'redux';
import mockStore from 'tests/test_store';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {GlobalState} from 'types/store';

Просмотреть файл

@@ -4,11 +4,9 @@
import {shallow} from 'enzyme';
import React from 'react';
import {screen} from '@testing-library/react';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {renderWithIntl, renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntl, renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {GlobalState} from '@mattermost/types/store';

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import deepFreeze from 'mattermost-redux/utils/deep_freeze';
import {Channel} from '@mattermost/types/channels';
import CloseCircleIcon from 'components/widgets/icons/close_circle_icon';

Просмотреть файл

@@ -2,13 +2,17 @@
// See LICENSE.txt for license information.
import React from 'react';
import {act, fireEvent, screen} from '@testing-library/react';
import {DeepPartial} from '@mattermost/types/utilities';
import {GlobalState} from 'types/store';
import {General} from 'mattermost-redux/constants';
import {LicenseLinks, OverActiveUserLimits, Preferences, SelfHostedProducts, StatTypes} from 'utils/constants';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {
act,
fireEvent,
renderWithIntlAndStore,
screen,
} from 'tests/react_testing_utils';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {trackEvent} from 'actions/telemetry_actions';
import {TestHelper} from 'utils/test_helper';

Просмотреть файл

@@ -4,18 +4,25 @@
import React from 'react';
import {act} from 'react-dom/test-utils';
import {createChannel} from 'mattermost-redux/actions/channels';
import Permissions from 'mattermost-redux/constants/permissions';
import {
render,
renderWithIntl,
screen,
userEvent,
waitFor,
} from 'tests/react_testing_utils';
import {GlobalState} from 'types/store';
import {suitePluginIds} from 'utils/constants';
import {cleanUpUrlable} from 'utils/url';
import {GlobalState} from 'types/store';
import Permissions from 'mattermost-redux/constants/permissions';
import {createChannel} from 'mattermost-redux/actions/channels';
jest.mock('mattermost-redux/actions/channels');
import NewChannelModal from './new_channel_modal';
import {render, screen, waitFor} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {renderWithIntl} from 'tests/react_testing_utils';
jest.mock('mattermost-redux/actions/channels');
const mockDispatch = jest.fn();
let mockState: GlobalState;

Просмотреть файл

@@ -1,11 +1,15 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {fireEvent, screen, act} from '@testing-library/react';
import React from 'react';
import * as reactRedux from 'react-redux';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {
act,
fireEvent,
renderWithIntlAndStore,
screen,
} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
import {GatherIntent} from './gather_intent';

Просмотреть файл

@@ -1,10 +1,9 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {fireEvent, screen} from '@testing-library/react';
import React from 'react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {fireEvent, renderWithIntl, screen} from 'tests/react_testing_utils';
import {GatherIntentModal, GatherIntentModalProps} from './gather_intent_modal';

Просмотреть файл

@@ -1,12 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {screen} from '@testing-library/react';
import React from 'react';
import {DeepPartial} from '@mattermost/types/utilities';
import {renderWithFullContext} from 'tests/react_testing_utils';
import {renderWithFullContext, screen} from 'tests/react_testing_utils';
import {GlobalState} from 'types/store';

Просмотреть файл

@@ -3,8 +3,9 @@
import React from 'react';
import {render, screen} from 'tests/react_testing_utils';
import PostEmoji from './post_emoji';
import {render, screen} from '@testing-library/react';
describe('PostEmoji', () => {
const baseProps = {

Просмотреть файл

@@ -3,14 +3,15 @@
import React from 'react';
import {Post, PostType} from '@mattermost/types/posts';
import {Posts} from 'mattermost-redux/constants';
import PostMarkdown from 'components/post_markdown/post_markdown';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
import {Post, PostType} from '@mattermost/types/posts';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import PostMarkdown from './post_markdown';
describe('components/PostMarkdown', () => {
const baseProps = {

Просмотреть файл

@@ -3,10 +3,11 @@
import React, {ComponentProps} from 'react';
import {render, screen} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
import PostProfilePicture from './post_profile_picture';
import {render, screen} from '@testing-library/react';
type Props = ComponentProps<typeof PostProfilePicture>;

Просмотреть файл

@@ -9,8 +9,7 @@ import {UserProfile} from '@mattermost/types/users';
import {Channel, ChannelType} from '@mattermost/types/channels';
import ChannelIntroMessage from './channel_intro_message';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
describe('components/post_view/ChannelIntroMessages', () => {

Просмотреть файл

@@ -5,11 +5,11 @@ import React from 'react';
import {Posts} from 'mattermost-redux/constants';
import LastUsers from './last_users';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore, screen, userEvent} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
import userEvent from '@testing-library/user-event';
import LastUsers from './last_users';
describe('components/post_view/combined_system_message/LastUsers', () => {
const formatOptions = {

Просмотреть файл

@@ -3,9 +3,9 @@
import React from 'react';
import {render, renderWithIntl, screen} from 'tests/react_testing_utils';
import CommentedOnFilesMessage from './commented_on_files_message';
import {render, screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
describe('components/CommentedOnFilesMessage', () => {
const baseProps = {

Просмотреть файл

@@ -3,9 +3,9 @@
import React from 'react';
import DateSeparator from 'components/post_view/date_separator/date_separator';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import DateSeparator from './date_separator';
describe('components/post_view/DateSeparator', () => {
const initialState = {

Просмотреть файл

@@ -4,13 +4,17 @@
import React from 'react';
import {AppBinding, AppCallResponse} from '@mattermost/types/apps';
import {Post} from '@mattermost/types/posts';
import {
renderWithIntlAndStore,
screen,
userEvent,
waitFor,
} from 'tests/react_testing_utils';
import ButtonBinding, {ButtonBinding as ButtonBindingUnwrapped} from './button_binding';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {screen, waitFor} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
describe('components/post_view/embedded_bindings/button_binding/', () => {
const post = {
id: 'some_post_id',

Просмотреть файл

@@ -3,12 +3,11 @@
import React from 'react';
import {TestHelper} from 'utils/test_helper';
import FailedPostOptions from 'components/post_view/failed_post_options/failed_post_options';
import {renderWithIntl} from 'tests/react_testing_utils';
import {screen} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {renderWithIntl, screen, userEvent} from 'tests/react_testing_utils';
import {TestHelper} from 'utils/test_helper';
describe('components/post_view/FailedPostOptions', () => {
const baseProps = {

Просмотреть файл

@@ -3,9 +3,9 @@
import React from 'react';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import FloatingTimestamp from './floating_timestamp';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
describe('components/post_view/FloatingTimestamp', () => {
const baseProps = {

Просмотреть файл

@@ -3,13 +3,13 @@
import React from 'react';
import {Preferences} from 'mattermost-redux/constants';
import {Theme} from 'mattermost-redux/selectors/entities/preferences';
import {changeOpacity} from 'mattermost-redux/utils/theme_utils';
import {Preferences} from 'mattermost-redux/constants';
import ActionButton from 'components/post_view/message_attachments/action_button/action_button';
import {render, screen} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {render, screen, userEvent} from 'tests/react_testing_utils';
import ActionButton from './action_button';
describe('components/post_view/message_attachments/action_button.jsx', () => {
const baseProps = {

Просмотреть файл

@@ -3,9 +3,9 @@
import React from 'react';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import ActionMenu from './action_menu';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
describe('components/post_view/message_attachments/ActionMenu', () => {
const baseProps = {

Просмотреть файл

@@ -3,9 +3,9 @@
import React from 'react';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import NewMessageSeparator from './new_message_separator';
import {screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
describe('components/post_view/new_message_separator', () => {
test('should render new_message_separator', () => {

Просмотреть файл

@@ -3,12 +3,12 @@
import React from 'react';
import PostAttachmentContainer, {Props} from './post_attachment_container';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {DeepPartial} from '@mattermost/types/utilities';
import {GlobalState} from '@mattermost/types/store';
import PostAttachmentContainer, {Props} from './post_attachment_container';
describe('PostAttachmentContainer', () => {
const baseProps: Props = {
children: <p>{'some children'}</p>,

Просмотреть файл

@@ -3,18 +3,17 @@
import React from 'react';
import {createIntl, useIntl} from 'react-intl';
import {Provider} from 'react-redux';
import enMessages from 'i18n/en.json';
import esMessages from 'i18n/es.json';
import {render, renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {mockStore} from 'tests/test_store';
import {TestHelper} from 'utils/test_helper';
import LatestPostReader from './latest_post_reader';
import {render, screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {Provider} from 'react-redux';
jest.mock('react-intl', () => ({
...jest.requireActual('react-intl'),

Просмотреть файл

@@ -2,7 +2,8 @@
// See LICENSE.txt for license information.
import React, {ComponentProps} from 'react';
import {render, screen, fireEvent} from '@testing-library/react';
import {fireEvent, render, screen} from 'tests/react_testing_utils';
import {withIntl} from 'tests/helpers/intl-test-helper';
import InviteMembers from './invite_members';

Просмотреть файл

@@ -2,11 +2,14 @@
// See LICENSE.txt for license information.
import React from 'react';
import {render, screen, fireEvent} from '@testing-library/react';
import {trackEvent} from 'actions/telemetry_actions';
import InviteMembersLink from './invite_members_link';
import {fireEvent, render, screen} from 'tests/react_testing_utils';
import {withIntl} from 'tests/helpers/intl-test-helper';
import InviteMembersLink from './invite_members_link';
jest.mock('actions/telemetry_actions', () => ({
trackEvent: jest.fn(),
}));

Просмотреть файл

@@ -2,11 +2,14 @@
// See LICENSE.txt for license information.
import React from 'react';
import {render} from '@testing-library/react';
import {BadUrlReasons} from 'utils/url';
import OrganizationStatus, {TeamApiError} from './organization_status';
import {render} from 'tests/react_testing_utils';
import {withIntl} from 'tests/helpers/intl-test-helper';
import {BadUrlReasons} from 'utils/url';
import OrganizationStatus, {TeamApiError} from './organization_status';
describe('components/preparing-workspace/organization_status', () => {
const defaultProps = {
error: null,

Просмотреть файл

@@ -2,11 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import * as redux from 'react-redux';
import {screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {CloudProducts} from 'utils/constants';

Просмотреть файл

@@ -2,11 +2,10 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {DeepPartial} from '@mattermost/types/utilities';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import {GlobalState} from 'types/store';
import {TestHelper as TH} from 'utils/test_helper';
import {Client4} from 'mattermost-redux/client';

Просмотреть файл

@@ -2,7 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {render} from '@testing-library/react';
import {render} from 'tests/react_testing_utils';
import RootPortal from './root_portal';

Просмотреть файл

@@ -2,9 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
import * as controlModalHooks from 'components/common/hooks/useControlModal';

Просмотреть файл

@@ -2,15 +2,16 @@
// See LICENSE.txt for license information.
import React, {ComponentProps} from 'react';
import {render} from '@testing-library/react';
import {IntlProvider} from 'react-intl';
import {Provider} from 'react-redux';
import SearchDateProvider from 'components/suggestion/search_date_provider';
import SearchChannelProvider from 'components/suggestion/search_channel_provider';
import SearchUserProvider from 'components/suggestion/search_user_provider';
import en from 'i18n/en.json';
import {render} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import SearchBar from './search_bar';

Просмотреть файл

@@ -2,9 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import {RHSStates} from 'utils/constants';
import {RhsState} from 'types/store/rhs';

Просмотреть файл

@@ -3,13 +3,16 @@
import React from 'react';
import {screen, fireEvent, waitFor} from '@testing-library/react';
import {GlobalState} from 'types/store';
import {SelfHostedSignupForm, SelfHostedSignupProgress} from '@mattermost/types/hosted_customer';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {
fireEvent,
renderWithIntlAndStore,
screen,
waitFor,
} from 'tests/react_testing_utils';
import {TestHelper as TH} from 'utils/test_helper';
import {SelfHostedProducts, ModalIdentifiers, RecurringIntervals} from 'utils/constants';

Просмотреть файл

@@ -3,13 +3,17 @@
import React from 'react';
import {screen, fireEvent, waitFor} from '@testing-library/react';
import {GlobalState} from 'types/store';
import {SelfHostedSignupForm, SelfHostedSignupProgress} from '@mattermost/types/hosted_customer';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {
fireEvent,
renderWithIntlAndStore,
screen,
waitFor,
} from 'tests/react_testing_utils';
import {TestHelper as TH} from 'utils/test_helper';
import {SelfHostedProducts, ModalIdentifiers} from 'utils/constants';

Просмотреть файл

@@ -5,7 +5,6 @@ import React from 'react';
import {shallow, ReactWrapper} from 'enzyme';
import {IntlProvider} from 'react-intl';
import {BrowserRouter} from 'react-router-dom';
import {act, screen} from '@testing-library/react';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
@@ -19,7 +18,7 @@ import {RequestStatus} from 'mattermost-redux/constants';
import {ClientConfig} from '@mattermost/types/config';
import {GlobalState} from 'types/store';
import {WindowSizes} from 'utils/constants';
import {renderWithIntlAndStore} from 'tests/react_testing_utils';
import {act, renderWithIntlAndStore, screen} from 'tests/react_testing_utils';
let mockState: GlobalState;
let mockLocation = {pathname: '', search: '', hash: ''};

Просмотреть файл

@@ -1,14 +1,18 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {act, RenderResult, screen} from '@testing-library/react';
import React from 'react';
import {Provider} from 'react-redux';
import mockStore from 'tests/test_store';
import {ModalIdentifiers} from 'utils/constants';
import StartTrialFormModal from '.';
import {BrowserRouter} from 'react-router-dom';
import {renderWithIntl} from 'tests/react_testing_utils';
import {
act,
RenderResult,
renderWithIntl,
screen,
} from 'tests/react_testing_utils';
import {trackEvent} from 'actions/telemetry_actions';
jest.mock('actions/telemetry_actions.jsx', () => {

Просмотреть файл

@@ -3,13 +3,13 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
import {General} from 'mattermost-redux/constants';
import {displayUsername} from 'mattermost-redux/utils/user_utils';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {TestHelper} from 'utils/test_helper';

Просмотреть файл

@@ -3,7 +3,6 @@
import React from 'react';
import {Provider} from 'react-redux';
import {act} from '@testing-library/react';
import {ReactWrapper} from 'enzyme';
import {BrowserRouter} from 'react-router-dom';
@@ -11,6 +10,7 @@ import {UserProfile} from '@mattermost/types/users';
import {Group} from '@mattermost/types/groups';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {TestHelper} from 'utils/test_helper';

Просмотреть файл

@@ -4,8 +4,8 @@
import React from 'react';
import {mount, ReactWrapper} from 'enzyme';
import * as reactRedux from 'react-redux';
import {act} from '@testing-library/react';
import {act} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {CloudProducts, LicenseSkus} from 'utils/constants';

Просмотреть файл

@@ -5,14 +5,14 @@ import React, {ComponentProps} from 'react';
import {shallow} from 'enzyme';
import {IntlProvider} from 'react-intl';
import {Provider} from 'react-redux';
import {render, fireEvent, screen} from '@testing-library/react';
import {Preferences} from 'mattermost-redux/constants';
import UserSettingsTheme from 'components/user_settings/display/user_settings_theme/user_settings_theme';
import {render, fireEvent, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import UserSettingsTheme from './user_settings_theme';
jest.mock('utils/utils', () => ({
applyTheme: jest.fn(),
toTitleCase: jest.fn(),

Просмотреть файл

@@ -2,10 +2,9 @@
// See LICENSE.txt for license information.
import React from 'react';
import {screen} from '@testing-library/react';
import {Provider} from 'react-redux';
import {renderWithIntl} from 'tests/react_testing_utils';
import {renderWithIntl, screen} from 'tests/react_testing_utils';
import mockStore from 'tests/test_store';
import {LimitSummary} from 'components/common/hooks/useGetHighestThresholdCloudLimit';

Просмотреть файл

@@ -1,7 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {screen} from '@testing-library/react';
import React from 'react';
import {FormattedMessage, useIntl} from 'react-intl';
import {connect, useSelector} from 'react-redux';
@@ -14,7 +13,7 @@ import {GlobalState} from 'types/store';
import {TestHelper} from 'utils/test_helper';
import {renderWithFullContext} from './react_testing_utils';
import {renderWithFullContext, screen} from './react_testing_utils';
describe('renderWithFullContext', () => {
test('should be able to render anything', () => {

Просмотреть файл

@@ -2,6 +2,7 @@
// See LICENSE.txt for license information.
import {render} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {createBrowserHistory} from 'history';
import React from 'react';
import {IntlProvider} from 'react-intl';
@@ -10,12 +11,16 @@ import {Router} from 'react-router-dom';
import {DeepPartial} from '@mattermost/types/utilities';
import mergeObjects from 'packages/mattermost-redux/test/merge_objects';
import configureStore from 'store';
import mockStore from 'tests/test_store';
import {GlobalState} from 'types/store';
import mergeObjects from 'packages/mattermost-redux/test/merge_objects';
export * from '@testing-library/react';
export {userEvent};
export const renderWithIntl = (component: React.ReactNode | React.ReactNodeArray, locale = 'en') => {
return render(<IntlProvider locale={locale}>{component}</IntlProvider>);