@@ -5,6 +5,7 @@ import { describe, expect, it, vi } from 'vitest';
55
66import ModuleMenu from '@app/homeV3/module/components/ModuleMenu' ;
77import { ModulePositionInput } from '@app/homeV3/template/types' ;
8+ import CustomThemeProvider from '@src/CustomThemeProvider' ;
89
910import { PageModuleFragment } from '@graphql/template.generated' ;
1011import { DataHubPageModuleType , EntityType , PageModuleScope } from '@types' ;
@@ -61,6 +62,8 @@ vi.mock('@components', () => ({
6162 } ,
6263} ) ) ;
6364
65+ const renderWithTheme = ( ui : React . ReactElement ) => render ( < CustomThemeProvider > { ui } </ CustomThemeProvider > ) ;
66+
6467describe ( 'ModuleMenu' , ( ) => {
6568 const mockModule : PageModuleFragment = {
6669 urn : 'urn:li:dataHubPageModule:test' ,
@@ -83,7 +86,7 @@ describe('ModuleMenu', () => {
8386 } ) ;
8487
8588 it ( 'should render menu with correct items' , ( ) => {
86- render ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
89+ renderWithTheme ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
8790
8891 // Click to open the dropdown
8992 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -96,7 +99,7 @@ describe('ModuleMenu', () => {
9699 } ) ;
97100
98101 it ( 'should call removeModule when remove is clicked' , ( ) => {
99- render ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
102+ renderWithTheme ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
100103
101104 // Click to open the dropdown
102105 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -133,7 +136,7 @@ describe('ModuleMenu', () => {
133136 rowSide : 'right' ,
134137 } ;
135138
136- render ( < ModuleMenu module = { differentModule } position = { differentPosition } /> ) ;
139+ renderWithTheme ( < ModuleMenu module = { differentModule } position = { differentPosition } /> ) ;
137140
138141 // Click to open the dropdown
139142 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -154,7 +157,7 @@ describe('ModuleMenu', () => {
154157 } ) ;
155158
156159 it ( 'should render remove option with red color' , ( ) => {
157- render ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
160+ renderWithTheme ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
158161
159162 // Click to open the dropdown
160163 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -173,7 +176,7 @@ describe('ModuleMenu', () => {
173176 moduleIndex : 2 ,
174177 } ;
175178
176- render ( < ModuleMenu module = { mockModule } position = { positionWithModuleIndex } /> ) ;
179+ renderWithTheme ( < ModuleMenu module = { mockModule } position = { positionWithModuleIndex } /> ) ;
177180
178181 // Click to open the dropdown
179182 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -205,7 +208,7 @@ describe('ModuleMenu', () => {
205208 } ,
206209 } ;
207210
208- render ( < ModuleMenu module = { moduleWithLongName } position = { mockPosition } /> ) ;
211+ renderWithTheme ( < ModuleMenu module = { moduleWithLongName } position = { mockPosition } /> ) ;
209212
210213 // Click to open the dropdown
211214 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -231,7 +234,7 @@ describe('ModuleMenu', () => {
231234 // rowSide and moduleIndex are optional/undefined
232235 } ;
233236
234- render ( < ModuleMenu module = { mockModule } position = { minimalPosition } /> ) ;
237+ renderWithTheme ( < ModuleMenu module = { mockModule } position = { minimalPosition } /> ) ;
235238
236239 // Click to open the dropdown
237240 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -263,7 +266,7 @@ describe('ModuleMenu', () => {
263266 } ,
264267 } ;
265268
266- render ( < ModuleMenu module = { moduleWithSpecialChars } position = { mockPosition } /> ) ;
269+ renderWithTheme ( < ModuleMenu module = { moduleWithSpecialChars } position = { mockPosition } /> ) ;
267270
268271 // Click to open the dropdown
269272 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -284,7 +287,7 @@ describe('ModuleMenu', () => {
284287 } ) ;
285288
286289 it ( 'should handle edit option (placeholder functionality)' , ( ) => {
287- render ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
290+ renderWithTheme ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
288291
289292 // Click to open the dropdown
290293 const menuButton = screen . getByTestId ( 'icon' ) ;
@@ -306,7 +309,7 @@ describe('ModuleMenu', () => {
306309 } ) ;
307310
308311 it ( 'should handle multiple rapid clicks on remove' , ( ) => {
309- render ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
312+ renderWithTheme ( < ModuleMenu module = { mockModule } position = { mockPosition } /> ) ;
310313
311314 // Click to open the dropdown
312315 const menuButton = screen . getByTestId ( 'icon' ) ;
0 commit comments