mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-05-16 15:30:20 -07:00
40 lines
1007 B
TypeScript
40 lines
1007 B
TypeScript
import React from 'react';
|
|
import Enzyme, { mount } from 'enzyme';
|
|
import EnzymeToJson from 'enzyme-to-json';
|
|
import Adapter from 'enzyme-adapter-react-16';
|
|
import { BrowserRouter as Router } from 'react-router-dom';
|
|
import ShareAppOrScreenControlGroup from './ShareAppOrScreenControlGroup';
|
|
|
|
Enzyme.configure({ adapter: new Adapter() });
|
|
jest.useFakeTimers();
|
|
|
|
jest.mock('electron', () => {
|
|
return {
|
|
remote: {
|
|
getGlobal: (globalName: string) => {
|
|
if (globalName === 'desktopCapturerSourcesService') {
|
|
return {
|
|
getScreenSources: () => [],
|
|
getAppWindowSources: () => [],
|
|
};
|
|
}
|
|
return {};
|
|
},
|
|
},
|
|
};
|
|
});
|
|
|
|
it('should match exact snapshot', () => {
|
|
const subject = mount(
|
|
<>
|
|
<Router>
|
|
<ShareAppOrScreenControlGroup
|
|
handleNextEntireScreen={() => {}}
|
|
handleNextApplicationWindow={() => {}}
|
|
/>
|
|
</Router>
|
|
</>
|
|
);
|
|
expect(EnzymeToJson(subject)).toMatchSnapshot();
|
|
});
|