Yarn workspaces

Summary:
1) moved "sonar/desktop/src" to "sonar/desktop/app/src", so "app" is now a separate package containing the core Flipper app code
2) Configured yarn workspaces with the root in "sonar/desktop": app, static, pkg, doctor, headless-tests. Plugins are not included for now, I plan to do this later.

Reviewed By: jknoxville

Differential Revision: D20535782

fbshipit-source-id: 600b2301960f37c7d72166e0d04eba462bec9fc1
This commit is contained in:
Anton Nikolaev
2020-03-20 13:31:37 -07:00
committed by Facebook GitHub Bot
parent 676d7bbd24
commit 863f89351e
340 changed files with 1635 additions and 294 deletions

View File

@@ -0,0 +1,89 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import MarkerTimeline from '../MarkerTimeline';
test('merges points with same timestamp', () => {
const points = [
{key: 'marker1', label: 'marker1', time: 41},
{key: 'marker2', label: 'marker2', time: 41},
];
const {timePoints} = MarkerTimeline.getDerivedStateFromProps({
lineHeight: 22,
maxGap: 100,
points,
});
expect(timePoints[0].markerNames).toContain('marker1');
expect(timePoints[0].markerNames).toContain('marker2');
});
test('sorts points', () => {
const {timePoints} = MarkerTimeline.getDerivedStateFromProps({
lineHeight: 22,
maxGap: 100,
points: [
{key: 'marker1', label: 'marker1', time: 20},
{key: 'marker2', label: 'marker2', time: -50},
],
});
expect(timePoints[0].timestamp).toBe(-50);
expect(timePoints[1].timestamp).toBe(20);
});
test('handles negative timestamps', () => {
const points = [{label: 'preStartPoint', key: 'preStartPoint', time: -50}];
const {timePoints} = MarkerTimeline.getDerivedStateFromProps({
lineHeight: 22,
maxGap: 100,
points,
});
expect(timePoints[0].timestamp).toBe(-50);
});
test('no points', () => {
const {timePoints} = MarkerTimeline.getDerivedStateFromProps({
lineHeight: 22,
maxGap: 100,
points: [],
});
expect(timePoints).toMatchSnapshot();
});
test('handles single point', () => {
const points = [{key: '1', label: 'single point', time: 0}];
const {timePoints} = MarkerTimeline.getDerivedStateFromProps({
lineHeight: 22,
maxGap: 100,
points,
});
expect(timePoints).toMatchSnapshot();
});
test('cuts long gaps', () => {
const points = [
{key: '1', label: 'single point', time: 1},
{key: '2', label: 'single point', time: 1000},
{key: '3', label: 'single point', time: 1001},
];
const MAX_GAP = 100;
const {timePoints} = MarkerTimeline.getDerivedStateFromProps({
lineHeight: 22,
maxGap: MAX_GAP,
points,
});
expect(timePoints[0].isCut).toBe(false);
expect(timePoints[1].isCut).toBe(true);
expect(timePoints[1].positionY).toBe(timePoints[0].positionY + MAX_GAP);
});

View File

@@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`handles single point 1`] = `
Array [
Object {
"color": "#ffffff",
"isCut": false,
"markerKeys": Array [
"1",
],
"markerNames": Array [
"single point",
],
"positionY": 0,
"timestamp": 0,
},
]
`;
exports[`no points 1`] = `Array []`;