diff --git a/packages/shared/src/components/ShareBar.spec.tsx b/packages/shared/src/components/ShareBar.spec.tsx index 275c4e34b4c..7daee6962c2 100644 --- a/packages/shared/src/components/ShareBar.spec.tsx +++ b/packages/shared/src/components/ShareBar.spec.tsx @@ -12,6 +12,8 @@ import { generateTestSquad } from '../../__tests__/fixture/squads'; import { getFacebookShareLink, getTwitterShareLink } from '../lib/share'; import { LazyModalElement } from './modals/LazyModalElement'; import { NotificationsContextProvider } from '../contexts/NotificationsContext'; +import SettingsContext from '../contexts/SettingsContext'; +import { settingsContext } from '../../__tests__/helpers/boot'; const defaultPost = Post; Object.defineProperty(window, 'matchMedia', { @@ -65,10 +67,12 @@ const renderComponent = ( loadedUserFromCache squads={customSquads} > - - - - + + + + + + , ); @@ -113,15 +117,20 @@ describe('ShareBar Test Suite:', () => { }); }); - it('should render the component with logged user and squads and open the share to squad modal', async () => { + it('should render the component with logged user and squads and open the share to squad composer', async () => { renderComponent(); const btn = await screen.findByTestId(`social-share-@${squads[0].handle}`); expect(btn).toBeInTheDocument(); btn.click(); await waitFor(() => { - expect(screen.getByText('New post')).toBeInTheDocument(); + expect( + screen.getByRole('textbox', { name: 'Post commentary' }), + ).toBeInTheDocument(); }); + expect(screen.getByRole('textbox', { name: 'Link URL' })).toHaveValue( + defaultPost.permalink, + ); }); it('should render the Facebook button and navigate to correct link', async () => { diff --git a/packages/shared/src/components/ShareBar.tsx b/packages/shared/src/components/ShareBar.tsx index 6b9461f11cf..6044ec84af3 100644 --- a/packages/shared/src/components/ShareBar.tsx +++ b/packages/shared/src/components/ShareBar.tsx @@ -79,12 +79,12 @@ export default function ShareBar({ post }: ShareBarProps): ReactElement { const onShareToSquad = (squad: Squad) => { logEvent(postLogEvent(LogEvent.StartShareToSquad, post)); openModal({ - type: LazyModal.CreateSharedPost, + type: LazyModal.SmartComposer, props: { - squad, + initialUrl: post.permalink, preview: post, - onSharedSuccessfully: () => - logEvent(postLogEvent(LogEvent.ShareToSquad, post)), + initialSquadId: squad.id, + onPosted: () => logEvent(postLogEvent(LogEvent.ShareToSquad, post)), }, }); }; diff --git a/packages/shared/src/components/liveRooms/CreateLiveRoomForm.spec.tsx b/packages/shared/src/components/liveRooms/CreateLiveRoomForm.spec.tsx deleted file mode 100644 index 3fa07f4174f..00000000000 --- a/packages/shared/src/components/liveRooms/CreateLiveRoomForm.spec.tsx +++ /dev/null @@ -1,192 +0,0 @@ -import { fireEvent, render, screen, waitFor } from '@testing-library/react'; -import React from 'react'; -import { CreateLiveRoomForm } from './CreateLiveRoomForm'; -import { LiveRoomMode } from '../../graphql/liveRooms'; - -const mockCreateLiveRoom = jest.fn(); -const mockDisplayToast = jest.fn(); -const mockLogEvent = jest.fn(); -const mockUseAuthContext = jest.fn(); - -jest.mock('../../hooks/liveRooms/useCreateLiveRoom', () => ({ - useCreateLiveRoom: () => ({ - mutateAsync: mockCreateLiveRoom, - isPending: false, - }), -})); - -jest.mock('../../hooks/useToastNotification', () => ({ - useToastNotification: () => ({ displayToast: mockDisplayToast }), -})); - -jest.mock('../fields/RichTextInput', () => ({ - __esModule: true, - default: ({ - initialContent, - maxInputLength, - onValueUpdate, - textareaProps, - }: { - initialContent?: string; - maxInputLength?: number; - onValueUpdate?: (value: string) => void; - textareaProps?: React.TextareaHTMLAttributes; - }) => ( -