-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4098f3a
commit d3e82b8
Showing
12 changed files
with
232 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,44 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { ConferenceContext } from 'pages/AntMedia'; | ||
import OthersCard from 'Components/Cards/OthersCard'; | ||
import theme from "styles/theme"; | ||
import { ThemeProvider } from '@mui/material/styles'; | ||
import {ThemeList} from "styles/themeList"; | ||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
import OthersCard from "Components/Cards/OthersCard"; | ||
import { ThemeProvider, createTheme } from "@mui/material/styles"; | ||
|
||
// Mock the context value | ||
const contextValue = { | ||
allParticipants: { | ||
'test-stream-id': { | ||
role: 'host', | ||
participantID: 'test-participant-id', | ||
streamID: 'test-stream-id', | ||
videoTrack: 'test-video-track', | ||
audioTrack: 'test-audio-track', | ||
videoLabel: 'test-video-label', | ||
// Mock theme with required properties | ||
const mockTheme = createTheme({ | ||
palette: { | ||
themeColor: { | ||
71: "#123456", // Replace with a mock color | ||
80: "#654321", | ||
85: "#abcdef", | ||
}, | ||
}, | ||
publishStreamId: 'test-stream-id', | ||
}; | ||
|
||
// Mock the useContext hook | ||
jest.mock('react', () => ({ | ||
...jest.requireActual('react'), | ||
useContext: jest.fn(), | ||
})); | ||
|
||
describe('OthersCard Component', () => { | ||
|
||
beforeEach(() => { | ||
// Reset the mock implementation before each test | ||
jest.clearAllMocks(); | ||
breakpoints: { | ||
values: { | ||
xs: 0, | ||
sm: 600, | ||
md: 960, | ||
lg: 1280, | ||
xl: 1920, | ||
}, | ||
}, | ||
}); | ||
|
||
React.useContext.mockImplementation(input => { | ||
if (input === ConferenceContext) { | ||
return contextValue; | ||
} | ||
return jest.requireActual('react').useContext(input); | ||
}); | ||
}); | ||
// Mock props for the component | ||
const props = { | ||
allParticipants: { | ||
"test-stream-id": { name: "John Doe" }, | ||
"another-stream-id": { name: "Jane Smith" }, | ||
}, | ||
publishStreamId: "test-stream-id", | ||
playingParticipants: [{ streamId: "test-stream-id" }], | ||
}; | ||
|
||
it('renders without crashing', () => { | ||
describe("OthersCard Component", () => { | ||
it("renders without crashing", () => { | ||
render( | ||
<ThemeProvider theme={theme(ThemeList.Green)}> | ||
<OthersCard/> | ||
</ThemeProvider> | ||
<ThemeProvider theme={mockTheme}> | ||
<OthersCard {...props} /> | ||
</ThemeProvider> | ||
); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 4 additions & 15 deletions
19
react/src/__tests__/Components/Footer/Components/FakeParticipantButton.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.