Run prettier

This commit is contained in:
Hypnosphi 2018-03-29 06:38:03 +03:00
parent c2dc5bfa08
commit a0b6eea992
4 changed files with 36 additions and 54 deletions

View File

@ -184,12 +184,10 @@ describe('Viewport/Panel', () => {
});
it('sets the state with the new information', () => {
expect(subject.instance().setState.mock.calls[0][0]).toEqual(
{
viewport: initialViewportAt(1),
isLandscape: false,
}
);
expect(subject.instance().setState.mock.calls[0][0]).toEqual({
viewport: initialViewportAt(1),
isLandscape: false,
});
});
});
@ -213,21 +211,17 @@ describe('Viewport/Panel', () => {
});
it('sets the state with the new information', () => {
expect(subject.instance().setState.mock.calls.length).toBe(2);
expect(subject.instance().setState.mock.calls[0][0]).toEqual(
{
storyDefaultViewport: 'iphone5'
}
);
expect(subject.instance().setState.mock.calls).toHaveLength(2);
expect(subject.instance().setState.mock.calls[0][0]).toEqual({
storyDefaultViewport: 'iphone5',
});
expect(subject.instance().setState.mock.calls[1][0]).toEqual(
{
viewport: initialViewportAt(1),
isLandscape: false
}
);
expect(subject.instance().setState.mock.calls[1][0]).toEqual({
viewport: initialViewportAt(1),
isLandscape: false,
});
expect(typeof subject.instance().setState.mock.calls[1][1]).toEqual('function');
const updaterFunction = subject.instance().setState.mock.calls[1][1];
updaterFunction();
@ -246,7 +240,7 @@ describe('Viewport/Panel', () => {
beforeEach(() => {
subject.instance().state = {
...subject.instance().state,
viewport: initialViewportAt(1)
viewport: initialViewportAt(1),
};
subject.instance().emitViewportChanged();
});
@ -254,10 +248,9 @@ describe('Viewport/Panel', () => {
it('emits viewport changed event', () => {
const viewport = transformedInitialViewports[initialViewportAt(1)];
expect(props.channel.emit).toHaveBeenCalledWith(
'addon:viewport:viewportChanged',
{ viewport }
);
expect(props.channel.emit).toHaveBeenCalledWith('addon:viewport:viewportChanged', {
viewport,
});
});
});

View File

@ -18,7 +18,7 @@ export default class Viewport extends React.Component {
static defaultProps = {
name: DEFAULT_VIEWPORT,
onViewportChange: noop
onViewportChange: noop,
};
constructor(props) {

View File

@ -49,10 +49,7 @@ describe('Viewport', () => {
subject = shallow(<Viewport {...props} onViewportChange={noop} />);
expect(channel.on).toHaveBeenCalledTimes(1);
expect(channel.on).toHaveBeenCalledWith(
'addon:viewport:viewportChanged',
noop
);
expect(channel.on).toHaveBeenCalledWith('addon:viewport:viewportChanged', noop);
});
});
@ -60,12 +57,9 @@ describe('Viewport', () => {
it('removes viewport changes listener', () => {
subject = shallow(<Viewport {...props} onViewportChange={noop} />);
subject.unmount();
expect(channel.removeListener).toHaveBeenCalledTimes(1);
expect(channel.removeListener).toHaveBeenCalledWith(
'addon:viewport:viewportChanged',
noop
);
expect(channel.removeListener).toHaveBeenCalledWith('addon:viewport:viewportChanged', noop);
});
});
@ -74,7 +68,7 @@ describe('Viewport', () => {
const propsWithCallback = {
name: 'unknown',
children: 'do not exist',
onViewportChange: jest.fn()
onViewportChange: jest.fn(),
};
beforeAll(() => {
@ -87,15 +81,13 @@ describe('Viewport', () => {
it('calls onViewportChange with the newly selected viewport', () => {
emitter.emit(VIEWPORT_CHANGED_EVENT_ID, {
viewport: INITIAL_VIEWPORTS.iphone5
viewport: INITIAL_VIEWPORTS.iphone5,
});
expect(propsWithCallback.onViewportChange).toHaveBeenCalled();
expect(propsWithCallback.onViewportChange).toHaveBeenCalledWith(
{
viewport: INITIAL_VIEWPORTS.iphone5
}
);
expect(propsWithCallback.onViewportChange).toHaveBeenCalledWith({
viewport: INITIAL_VIEWPORTS.iphone5,
});
});
});
});

View File

@ -58,27 +58,24 @@ if (!program.skipPackager) {
roots = roots.concat(program.root.split(',').map(root => path.resolve(root)));
}
try {
// eslint-disable-next-line global-require
require("babel-register")({
"presets": ["flow"],
// eslint-disable-next-line global-require
require('babel-register')({
presets: ['flow'],
ignore: false,
babelrc: false});
babelrc: false,
});
// eslint-disable-next-line global-require
// eslint-disable-next-line global-require
const findSymlinkedModules = require('react-native/local-cli/util/findSymlinkedModules');
symlinks = roots.reduce(
(arr, rootPath) => arr.concat(findSymlinkedModules(rootPath, roots)),
[...roots]
);
symlinks = roots.reduce((arr, rootPath) => arr.concat(findSymlinkedModules(rootPath, roots)), [
...roots,
]);
} catch (e) {
console.warn(`Unable to load findSymlinksPaths: ${e.message}`, e);
}
let projectRoots = (configDir === projectDir ? [] : [configDir]).concat(
symlinks
);
let projectRoots = (configDir === projectDir ? [] : [configDir]).concat(symlinks);
if (program.projectRoots) {
projectRoots = projectRoots.concat(