11import { render , screen } from '@testing-library/react' ;
22import userEvent from '@testing-library/user-event' ;
3- import NewMediaSection from '..' ;
3+ import MediaSectionV2 from '..' ;
44import useFeaturedImage from '../../../hooks/use-featured-image' ;
55import useImageGeneratorConfig from '../../../hooks/use-image-generator-config' ;
66import useMediaDetails from '../../../hooks/use-media-details' ;
@@ -76,26 +76,26 @@ jest.mock( '@wordpress/block-editor', () => ( {
7676 } ,
7777} ) ) ;
7878
79- describe ( 'NewMediaSection ' , ( ) => {
79+ describe ( 'MediaSectionV2 ' , ( ) => {
8080 beforeEach ( ( ) => {
8181 jest . clearAllMocks ( ) ;
8282 } ) ;
8383
8484 describe ( 'Initial rendering' , ( ) => {
8585 it ( 'should render the Media label' , ( ) => {
86- render ( < NewMediaSection /> ) ;
86+ render ( < MediaSectionV2 /> ) ;
8787
8888 expect ( screen . getByText ( 'Media' ) ) . toBeInTheDocument ( ) ;
8989 } ) ;
9090
9191 it ( 'should show featured image description when featured image is detected' , ( ) => {
92- render ( < NewMediaSection /> ) ;
92+ render ( < MediaSectionV2 /> ) ;
9393
9494 expect ( screen . getByText ( 'You are using your post featured image' ) ) . toBeInTheDocument ( ) ;
9595 } ) ;
9696
9797 it ( 'should show featured image preview' , ( ) => {
98- render ( < NewMediaSection /> ) ;
98+ render ( < MediaSectionV2 /> ) ;
9999
100100 const img = screen . getByRole ( 'img' ) ;
101101 expect ( img ) . toBeInTheDocument ( ) ;
@@ -120,13 +120,13 @@ describe( 'NewMediaSection', () => {
120120 } ) ;
121121
122122 it ( 'should show "no image" description when no media source is selected' , ( ) => {
123- render ( < NewMediaSection /> ) ;
123+ render ( < MediaSectionV2 /> ) ;
124124
125125 expect ( screen . getByText ( "Your post won't show an image." ) ) . toBeInTheDocument ( ) ;
126126 } ) ;
127127
128128 it ( 'should show Select button when no media' , ( ) => {
129- render ( < NewMediaSection /> ) ;
129+ render ( < MediaSectionV2 /> ) ;
130130
131131 expect ( screen . getByRole ( 'button' , { name : 'Select' } ) ) . toBeInTheDocument ( ) ;
132132 } ) ;
@@ -158,7 +158,7 @@ describe( 'NewMediaSection', () => {
158158 } ) ;
159159
160160 it ( 'should show custom image description when attached media exists' , ( ) => {
161- render ( < NewMediaSection /> ) ;
161+ render ( < MediaSectionV2 /> ) ;
162162
163163 expect ( screen . getByText ( 'You are using a custom image.' ) ) . toBeInTheDocument ( ) ;
164164 } ) ;
@@ -180,13 +180,13 @@ describe( 'NewMediaSection', () => {
180180 } ) ;
181181
182182 it ( 'should show SIG description when SIG is enabled' , ( ) => {
183- render ( < NewMediaSection /> ) ;
183+ render ( < MediaSectionV2 /> ) ;
184184
185185 expect ( screen . getByText ( 'You are using the template' ) ) . toBeInTheDocument ( ) ;
186186 } ) ;
187187
188188 it ( 'should show SIG preview image' , ( ) => {
189- render ( < NewMediaSection /> ) ;
189+ render ( < MediaSectionV2 /> ) ;
190190
191191 const img = screen . getByRole ( 'img' ) ;
192192 expect ( img ) . toHaveAttribute ( 'src' , 'https://example.com/sig-preview.jpg' ) ;
@@ -198,7 +198,7 @@ describe( 'NewMediaSection', () => {
198198 isLoading : true ,
199199 } ) ;
200200
201- render ( < NewMediaSection /> ) ;
201+ render ( < MediaSectionV2 /> ) ;
202202
203203 // When SIG is loading, the preview image should not be visible yet
204204 expect ( screen . queryByRole ( 'img' ) ) . not . toBeInTheDocument ( ) ;
@@ -215,7 +215,7 @@ describe( 'NewMediaSection', () => {
215215 it ( 'should call updateJetpackSocialOptions when selecting SIG' , async ( ) => {
216216 const user = userEvent . setup ( ) ;
217217
218- render ( < NewMediaSection /> ) ;
218+ render ( < MediaSectionV2 /> ) ;
219219
220220 // Open dropdown
221221 await user . click ( screen . getByRole ( 'button' , { name : 'Replace' } ) ) ;
@@ -239,7 +239,7 @@ describe( 'NewMediaSection', () => {
239239 setIsEnabled : jest . fn ( ) ,
240240 } ) ;
241241
242- render ( < NewMediaSection /> ) ;
242+ render ( < MediaSectionV2 /> ) ;
243243
244244 // Open dropdown
245245 await user . click ( screen . getByRole ( 'button' , { name : 'Replace' } ) ) ;
@@ -263,7 +263,7 @@ describe( 'NewMediaSection', () => {
263263 it ( 'should record analytics event when source is changed' , async ( ) => {
264264 const user = userEvent . setup ( ) ;
265265
266- render ( < NewMediaSection analyticsData = { { test : 'data' } } /> ) ;
266+ render ( < MediaSectionV2 analyticsData = { { test : 'data' } } /> ) ;
267267
268268 // Open dropdown
269269 await user . click ( screen . getByRole ( 'button' , { name : 'Replace' } ) ) ;
@@ -282,7 +282,7 @@ describe( 'NewMediaSection', () => {
282282 it ( 'should clear media and record event when Remove is clicked' , async ( ) => {
283283 const user = userEvent . setup ( ) ;
284284
285- render ( < NewMediaSection analyticsData = { { test : 'data' } } /> ) ;
285+ render ( < MediaSectionV2 analyticsData = { { test : 'data' } } /> ) ;
286286
287287 await user . click ( screen . getByRole ( 'button' , { name : 'Remove' } ) ) ;
288288
@@ -300,7 +300,7 @@ describe( 'NewMediaSection', () => {
300300
301301 describe ( 'Disabled state' , ( ) => {
302302 it ( 'should disable buttons when disabled prop is true' , ( ) => {
303- render ( < NewMediaSection disabled = { true } /> ) ;
303+ render ( < MediaSectionV2 disabled = { true } /> ) ;
304304
305305 expect ( screen . getByRole ( 'button' , { name : 'Replace' } ) ) . toBeDisabled ( ) ;
306306 expect ( screen . getByRole ( 'button' , { name : 'Remove' } ) ) . toBeDisabled ( ) ;
0 commit comments