Skip to content

Commit

Permalink
Fix failed test
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaboleken committed Dec 17, 2024
1 parent 7f0b266 commit b5229fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion react/src/Components/Footer/Components/OptionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ function OptionButton(props) {

{props?.isPlayOnly === false
&& process.env.REACT_APP_CALL_SETTINGS_VIRTUAL_BACKGROUND_MODE_VISIBILITY === 'true' ?
<MenuItem onClick={() => { props?.handleEffectsOpen(!props?.effectsDrawerOpen); handleClose(); }}>
<MenuItem onClick={() => { props?.handleEffectsOpen(!props?.effectsDrawerOpen); handleClose(); }}
id="virtual-effects">
<ListItemIcon>
<SvgIcon size={36} name={"background-replacement"} color={theme.palette?.iconColor?.primary} />
</ListItemIcon>
Expand Down
19 changes: 19 additions & 0 deletions react/src/__tests__/pages/WaitingRoom.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import { render } from '@testing-library/react';
import React from "react";
import WaitingRoom from "../../pages/WaitingRoom";
import { ConferenceContext } from 'pages/AntMedia';

const contextValue = {
initialized: true,
setLocalVideo: jest.fn(),
localVideoCreate: jest.fn(),
setIsJoining: jest.fn(),
joinRoom: jest.fn(),
localVideo: {},
setSpeedTestObject: jest.fn(),
makeId: jest.fn(),
};

const props = {
isPlayOnly: false,
Expand Down Expand Up @@ -51,6 +63,7 @@ const props = {
// Mock the useContext hook
jest.mock('react', () => ({
...jest.requireActual('react'),
useContext: jest.fn(),
}));

jest.mock('utils', () => ({
Expand Down Expand Up @@ -88,6 +101,12 @@ describe('Waiting Room Component', () => {
beforeEach(() => {
// Reset the mock implementation before each test
jest.clearAllMocks();
React.useContext.mockImplementation(input => {
if (input === ConferenceContext) {
return contextValue;
}
return jest.requireActual('react').useContext(input);
});
});


Expand Down

0 comments on commit b5229fe

Please sign in to comment.