diff --git a/src/components/Buttons/EndCallButton/EndCallButton.test.tsx b/src/components/Buttons/EndCallButton/EndCallButton.test.tsx
index faf7769e0..940dd6afe 100644
--- a/src/components/Buttons/EndCallButton/EndCallButton.test.tsx
+++ b/src/components/Buttons/EndCallButton/EndCallButton.test.tsx
@@ -7,56 +7,14 @@ const mockVideoContext = {
room: {
disconnect: jest.fn(),
},
- isSharingScreen: false,
- toggleScreenShare: jest.fn(),
- removeLocalAudioTrack: jest.fn(),
- removeLocalVideoTrack: jest.fn(),
};
jest.mock('../../../hooks/useVideoContext/useVideoContext', () => () => mockVideoContext);
describe('End Call button', () => {
- describe('when it is clicked', () => {
- describe('while sharing screen', () => {
- let wrapper;
-
- beforeAll(() => {
- jest.clearAllMocks();
- mockVideoContext.isSharingScreen = true;
- wrapper = shallow();
- wrapper.simulate('click');
- });
-
- it('should stop local audio tracks', () => {
- expect(mockVideoContext.removeLocalAudioTrack).toHaveBeenCalled();
- });
-
- it('should stop local video tracks', () => {
- expect(mockVideoContext.removeLocalVideoTrack).toHaveBeenCalled();
- });
-
- it('should toggle screen sharing off', () => {
- expect(mockVideoContext.toggleScreenShare).toHaveBeenCalled();
- });
-
- it('should disconnect from the room ', () => {
- expect(mockVideoContext.room.disconnect).toHaveBeenCalled();
- });
- });
-
- describe('while not sharing screen', () => {
- let wrapper;
-
- beforeAll(() => {
- jest.clearAllMocks();
- mockVideoContext.isSharingScreen = false;
- wrapper = shallow();
- wrapper.simulate('click');
- });
-
- it('should not toggle screen sharing', () => {
- expect(mockVideoContext.toggleScreenShare).not.toHaveBeenCalled();
- });
- });
+ it('should disconnect from the room when clicked', () => {
+ const wrapper = shallow();
+ wrapper.simulate('click');
+ expect(mockVideoContext.room.disconnect).toHaveBeenCalled();
});
});
diff --git a/src/components/Buttons/EndCallButton/EndCallButton.tsx b/src/components/Buttons/EndCallButton/EndCallButton.tsx
index d34e60daf..d5d9bf76e 100644
--- a/src/components/Buttons/EndCallButton/EndCallButton.tsx
+++ b/src/components/Buttons/EndCallButton/EndCallButton.tsx
@@ -20,19 +20,10 @@ const useStyles = makeStyles((theme: Theme) =>
export default function EndCallButton(props: { className?: string }) {
const classes = useStyles();
- const { room, isSharingScreen, toggleScreenShare, removeLocalAudioTrack, removeLocalVideoTrack } = useVideoContext();
-
- const handleClick = () => {
- if (isSharingScreen) {
- toggleScreenShare();
- }
- removeLocalAudioTrack();
- removeLocalVideoTrack();
- room!.disconnect();
- };
+ const { room } = useVideoContext();
return (
-