Remove access to global state from some files (#26752)

* admin_console/license_settings/trial_banner

* invitation_modal and associated utils

* overlay trigger

* Change TrialBanner to not use makeGetCategory

* Address feedback

* Fixing unit tests D:

* Address further feedback

* Fix one last test
Этот коммит содержится в:
Harrison Healey
2024-04-22 14:53:42 -04:00
коммит произвёл GitHub
родитель 7429ddaf04
Коммит 22d72b6df8
34 изменённых файлов: 715 добавлений и 3619 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@@ -8,7 +8,7 @@ import type {Channel, ChannelMembership} from '@mattermost/types/channels';
import type {Theme} from 'mattermost-redux/selectors/entities/preferences';
import ChannelHeaderPlug from 'plugins/channel_header_plug/channel_header_plug';
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
import {renderWithContext} from 'tests/react_testing_utils';
import type {PluginComponent} from 'types/store/plugins';
@@ -22,8 +22,8 @@ describe('plugins/ChannelHeaderPlug', () => {
tooltipText: 'some tooltip text',
} as PluginComponent;
test('should match snapshot with no extended component', () => {
const wrapper = mountWithIntl(
test('should not render anything with no extended component', () => {
const {asFragment} = renderWithContext(
<ChannelHeaderPlug
components={[]}
channel={{} as Channel}
@@ -40,11 +40,11 @@ describe('plugins/ChannelHeaderPlug', () => {
shouldShowAppBar={false}
/>,
);
expect(wrapper).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
test('should match snapshot with one extended component', () => {
const wrapper = mountWithIntl(
const {asFragment} = renderWithContext(
<ChannelHeaderPlug
components={[testPlug]}
channel={{} as Channel}
@@ -61,11 +61,11 @@ describe('plugins/ChannelHeaderPlug', () => {
shouldShowAppBar={false}
/>,
);
expect(wrapper).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
test('should match snapshot with six extended components', () => {
const wrapper = mountWithIntl(
const {asFragment} = renderWithContext(
<ChannelHeaderPlug
components={[
testPlug,
@@ -98,11 +98,11 @@ describe('plugins/ChannelHeaderPlug', () => {
shouldShowAppBar={false}
/>,
);
expect(wrapper).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
test('should match snapshot when the App Bar is visible', () => {
const wrapper = mountWithIntl(
test('should not render anything when the App Bar is visible', () => {
const {asFragment} = renderWithContext(
<ChannelHeaderPlug
components={[
testPlug,
@@ -124,6 +124,6 @@ describe('plugins/ChannelHeaderPlug', () => {
shouldShowAppBar={true}
/>,
);
expect(wrapper).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
});