forked from electron/fiddle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings-general-github-spec.tsx
More file actions
34 lines (25 loc) · 991 Bytes
/
settings-general-github-spec.tsx
File metadata and controls
34 lines (25 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as React from 'react';
import { shallow } from 'enzyme';
import { GitHubSettings } from '../../../src/renderer/components/settings-general-github';
import { StateMock } from '../../mocks/mocks';
describe('GitHubSettings component', () => {
let store: StateMock;
beforeEach(() => {
({ state: store } = (window as any).ElectronFiddle.app);
});
it('renders when not signed in', () => {
const wrapper = shallow(<GitHubSettings appState={store as any} />);
expect(wrapper).toMatchSnapshot();
});
it('renders when signed in', () => {
store.gitHubToken = '123';
store.gitHubLogin = 'Test User';
const wrapper = shallow(<GitHubSettings appState={store as any} />);
expect(wrapper).toMatchSnapshot();
});
it('opens the token dialog on click', () => {
const wrapper = shallow(<GitHubSettings appState={store as any} />);
wrapper.childAt(1).childAt(1).simulate('click');
expect(store.isTokenDialogShowing).toBe(true);
});
});