adding jest test setup

Summary:
Adds a test runner for jest test and adds three simple test cases:
- render the app
- start a server
- client connecting to the app

Test can be run using `yarn test`.

To make the test runner work, some changes needed to be made:
- remove the export of `init()` from `'flipper'`, because it was a cyclic dependency
- updating Button.js to the new ref-API

Reviewed By: jknoxville

Differential Revision: D10027078

fbshipit-source-id: 49107b0dd4dec666b92ecd841422fe7e6b3a7756
This commit is contained in:
Daniel Büchele
2018-09-28 06:31:48 -07:00
committed by Facebook Github Bot
parent af1ff7f039
commit a455520ecb
14 changed files with 2191 additions and 511 deletions

View File

@@ -15,7 +15,6 @@ import MainSidebar from './chrome/MainSidebar.js';
import BugReporterDialog from './chrome/BugReporterDialog.js';
import ErrorBar from './chrome/ErrorBar.js';
import PluginContainer from './PluginContainer.js';
import PluginManager from './chrome/PluginManager.js';
import {ipcRenderer} from 'electron';
import type Logger from './fb-stubs/Logger.js';
@@ -30,7 +29,7 @@ type Props = {
pluginManagerVisible: boolean,
selectedDevice: ?BaseDevice,
error: ?string,
toggleBugDialogVisible: (visible?: boolean) => void,
toggleBugDialogVisible: (visible?: boolean) => any,
};
export class App extends React.Component<Props> {
@@ -55,7 +54,9 @@ export class App extends React.Component<Props> {
{this.props.bugDialogVisible && (
<BugReporterDialog
bugReporter={this.props.bugReporter}
close={() => this.props.toggleBugDialogVisible(false)}
close={() => {
this.props.toggleBugDialogVisible(false);
}}
/>
)}
<FlexRow fill={true}>