@@ -70,6 +70,7 @@ jest.mock('@webex/cc-store', () => {
7070 currentTask = mockCurrentTaskWithConversationId ;
7171 isDigitalChannelsInitialized = false ;
7272 dataCenter = mockDataCenter ;
73+ currentTheme = 'LIGHT' ;
7374 onErrorCallback = jest . fn ( ) ;
7475
7576 constructor ( ) {
@@ -85,6 +86,12 @@ jest.mock('@webex/cc-store', () => {
8586 } ) ;
8687 } ) ;
8788
89+ setCurrentTheme = jest . fn ( ( theme : string ) => {
90+ runInAction ( ( ) => {
91+ this . currentTheme = theme ;
92+ } ) ;
93+ } ) ;
94+
8895 getAccessToken = jest . fn ( ) . mockResolvedValue ( mockJwtToken ) ;
8996 }
9097
@@ -94,7 +101,6 @@ jest.mock('@webex/cc-store', () => {
94101import { DigitalChannels } from '../../src/digital-channels' ;
95102import { mockTask as mockTaskFixture } from '@webex/test-fixtures' ;
96103
97- const mockProps = { } ;
98104let mockShouldThrow = false ;
99105
100106jest . mock ( '../../src/digital-channels/DigitalChannelsComponent' , ( ) => {
@@ -117,7 +123,7 @@ describe('DigitalChannels Component - Integration Tests with Real Components', (
117123 } ) ;
118124
119125 it ( 'should successfully load and initialize real Engage component without errors' , async ( ) => {
120- const screen = render ( < DigitalChannels { ... mockProps } /> ) ;
126+ const screen = render ( < DigitalChannels /> ) ;
121127
122128 // Wait for the widget to be loaded in the DOM
123129 await waitFor (
@@ -155,8 +161,16 @@ describe('DigitalChannels Component - Integration Tests with Real Components', (
155161 expect ( engageWidget ) . toHaveAttribute ( 'data-visual-rebrand' , 'true' ) ;
156162 } ) ;
157163
158- it ( 'should render with dark theme when currentTheme is DARK' , async ( ) => {
159- const screen = render ( < DigitalChannels currentTheme = "DARK" /> ) ;
164+ it ( 'should render with dark theme when currentTheme is DARK in store' , async ( ) => {
165+ // eslint-disable-next-line @typescript-eslint/no-require-imports
166+ const storeModule = require ( '@webex/cc-store' ) ;
167+
168+ // Set dark theme in store before rendering
169+ runInAction ( ( ) => {
170+ storeModule . default . currentTheme = 'DARK' ;
171+ } ) ;
172+
173+ const screen = render ( < DigitalChannels /> ) ;
160174
161175 // Wait for the widget to be loaded in the DOM
162176 await waitFor (
@@ -179,6 +193,14 @@ describe('DigitalChannels Component - Integration Tests with Real Components', (
179193 const engageWidget = screen . getByTestId ( 'engage-widget' ) ;
180194 expect ( engageWidget ) . toBeInTheDocument ( ) ;
181195 expect ( engageWidget ) . toHaveAttribute ( 'data-theme' , 'dark' ) ;
196+
197+ // Unmount the component before resetting theme to avoid act() warning
198+ screen . unmount ( ) ;
199+
200+ // Reset theme to default for other tests
201+ runInAction ( ( ) => {
202+ storeModule . default . currentTheme = 'LIGHT' ;
203+ } ) ;
182204 } ) ;
183205
184206 it ( 'should have proper store integration' , async ( ) => {
@@ -194,7 +216,7 @@ describe('DigitalChannels Component - Integration Tests with Real Components', (
194216 expect ( storeModule . default . onErrorCallback ) . toBeDefined ( ) ;
195217
196218 // Component should be able to access store without issues
197- const screen = render ( < DigitalChannels { ... mockProps } /> ) ;
219+ const screen = render ( < DigitalChannels /> ) ;
198220
199221 // Wait for the widget to appear in the DOM, proving store integration works
200222 await waitFor (
@@ -231,7 +253,7 @@ describe('DigitalChannels Component - Integration Tests with Real Components', (
231253 } ) ;
232254 } ) ;
233255
234- const screen = render ( < DigitalChannels { ... mockProps } /> ) ;
256+ const screen = render ( < DigitalChannels /> ) ;
235257
236258 // Verify nothing is rendered when currentTask is null
237259 expect ( screen . container . querySelector ( 'md-theme' ) ) . toBeNull ( ) ;
@@ -295,7 +317,7 @@ describe('DigitalChannels Component - Integration Tests with Real Components', (
295317 } ) ;
296318
297319 it ( 'should not render' , async ( ) => {
298- const screen = render ( < DigitalChannels { ... mockProps } /> ) ;
320+ const screen = render ( < DigitalChannels /> ) ;
299321
300322 // Wait for any async updates to complete
301323 await waitFor ( ( ) => {
@@ -333,7 +355,7 @@ describe('DigitalChannels Component - Integration Tests with Real Components', (
333355 } ) ;
334356
335357 it ( 'should not render' , async ( ) => {
336- const screen = render ( < DigitalChannels { ... mockProps } /> ) ;
358+ const screen = render ( < DigitalChannels /> ) ;
337359
338360 // Wait for any async updates to complete
339361 await waitFor ( ( ) => {
@@ -369,7 +391,7 @@ describe('DigitalChannels ErrorBoundary', () => {
369391
370392 mockShouldThrow = true ;
371393
372- const screen = render ( < DigitalChannels { ... mockProps } /> ) ;
394+ const screen = render ( < DigitalChannels /> ) ;
373395
374396 await waitFor ( ( ) => {
375397 expect ( onErrorCallback ) . toHaveBeenCalledWith ( 'DigitalChannels' , expect . any ( Error ) ) ;
@@ -392,7 +414,7 @@ describe('DigitalChannels ErrorBoundary', () => {
392414 mockShouldThrow = true ;
393415
394416 // Render should not throw when onErrorCallback is undefined
395- const screen = render ( < DigitalChannels { ... mockProps } /> ) ;
417+ const screen = render ( < DigitalChannels /> ) ;
396418
397419 // Wait for error boundary to catch and handle the error
398420 await waitFor ( ( ) => {
0 commit comments