Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video 3730 add conversation hooks #438

Merged
merged 14 commits into from
Mar 2, 2021
Prev Previous commit
Next Next commit
Fix DeviceSelectionScreen tests
  • Loading branch information
Tim Mendoza committed Feb 25, 2021
commit d2360436c6dddf58593aa6fca486417c212de662
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import useVideoContext from '../../../hooks/useVideoContext/useVideoContext';
import ToggleVideoButton from '../../Buttons/ToggleVideoButton/ToggleVideoButton';
import ToggleAudioButton from '../../Buttons/ToggleAudioButton/ToggleAudioButton';

jest.mock('../../../hooks/useVideoContext/useVideoContext');
jest.mock('../../../state');

const mockUseAppState = useAppState as jest.Mock<any>;
const mockUseVideoContext = useVideoContext as jest.Mock<any>;

const mockConnect = jest.fn();
const mockChatConnect = jest.fn(() => Promise.resolve());
const mockGetToken = jest.fn(() => Promise.resolve('mockToken'));

jest.mock('../../../hooks/useChatContext/useChatContext', () => () => ({ connect: mockChatConnect }));
jest.mock('../../../hooks/useVideoContext/useVideoContext');
jest.mock('../../../state');

mockUseAppState.mockImplementation(() => ({ getToken: mockGetToken, isFetching: false }));
mockUseVideoContext.mockImplementation(() => ({
connect: mockConnect,
Expand Down Expand Up @@ -109,6 +111,7 @@ describe('the DeviceSelectionScreen component', () => {
expect(mockGetToken).toHaveBeenCalledWith('test name', 'test room name');
setImmediate(() => {
expect(mockConnect).toHaveBeenCalledWith('mockToken');
expect(mockChatConnect).toHaveBeenCalledWith('mockToken');
done();
});
});
Expand Down