diff --git a/webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.test.tsx b/webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.test.tsx new file mode 100644 index 0000000000..cbdd62a61a --- /dev/null +++ b/webapp/channels/src/components/cloud_preview_modal/cloud_preview_modal_controller.test.tsx @@ -0,0 +1,183 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {fireEvent, screen, waitFor} from '@testing-library/react'; +import React from 'react'; +import * as reactRedux from 'react-redux'; + +import type {Subscription} from '@mattermost/types/cloud'; + +import {renderWithContext} from 'tests/react_testing_utils'; + +import CloudPreviewModal from './cloud_preview_modal_controller'; + +// Mock the async_load module to return components synchronously +jest.mock('components/async_load', () => ({ + makeAsyncComponent: (displayName: string) => { + // Return a component that renders immediately without suspense + const Component = (props: any) => { + // Mock the preview modal controller + if (displayName === 'PreviewModalController') { + return props.show ? ( +