Share uuid
Summary: Expose uuid from flipper-common as it is required in multiple packages Reviewed By: lblasa Differential Revision: D36441889 fbshipit-source-id: 1fa539cb437976dbefe7d5d9a52e5e098a6402a7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
88bc3110a5
commit
0f038218f8
@@ -39,7 +39,6 @@
|
||||
"serialize-error": "^8.1.0",
|
||||
"split2": "^4.1.0",
|
||||
"tmp": "^0.2.1",
|
||||
"uuid": "^8.3.2",
|
||||
"which": "^2.0.2",
|
||||
"ws": "^8.5.0",
|
||||
"xdg-basedir": "^4.0.0"
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {FlipperServerCommands, FlipperServerEvents} from 'flipper-common';
|
||||
import {FlipperServerCommands, FlipperServerEvents, uuid} from 'flipper-common';
|
||||
import {pathExists} from 'fs-extra';
|
||||
import {promises, createWriteStream, ReadStream} from 'fs';
|
||||
import axios from 'axios';
|
||||
import {v4 as uuid} from 'uuid';
|
||||
|
||||
const {unlink} = promises;
|
||||
|
||||
|
||||
@@ -10,9 +10,15 @@
|
||||
import axios from 'axios';
|
||||
import MemoryStream from 'memorystream';
|
||||
import {dirSync} from 'tmp';
|
||||
import * as uuid from 'uuid';
|
||||
import * as flipperCommon from 'flipper-common';
|
||||
import {commandDownloadFileStartFactory} from '../DownloadFile';
|
||||
|
||||
// https://stackoverflow.com/a/63374190
|
||||
jest.mock('flipper-common', () => ({
|
||||
__esModule: true,
|
||||
...jest.requireActual('flipper-common'),
|
||||
}));
|
||||
|
||||
describe('commands', () => {
|
||||
describe('DownloadFile', () => {
|
||||
let commandDownloadFileStart: ReturnType<
|
||||
@@ -60,7 +66,7 @@ describe('commands', () => {
|
||||
|
||||
const fakeDownloadURL = 'https://flipper.rocks';
|
||||
const fakeUuid = 'flipper42';
|
||||
jest.spyOn(uuid, 'v4').mockImplementation(() => fakeUuid);
|
||||
jest.spyOn(flipperCommon, 'uuid').mockImplementation(() => fakeUuid);
|
||||
|
||||
const downloadFileDescriptor = await commandDownloadFileStart(
|
||||
fakeDownloadURL,
|
||||
@@ -135,7 +141,7 @@ describe('commands', () => {
|
||||
|
||||
const fakeDownloadURL = 'https://flipper.rocks';
|
||||
const fakeUuid = 'flipper42';
|
||||
jest.spyOn(uuid, 'v4').mockImplementation(() => fakeUuid);
|
||||
jest.spyOn(flipperCommon, 'uuid').mockImplementation(() => fakeUuid);
|
||||
|
||||
await commandDownloadFileStart(fakeDownloadURL, dest);
|
||||
|
||||
@@ -177,7 +183,7 @@ describe('commands', () => {
|
||||
|
||||
const fakeDownloadURL = 'https://flipper.rocks';
|
||||
const fakeUuid = 'flipper42';
|
||||
jest.spyOn(uuid, 'v4').mockImplementation(() => fakeUuid);
|
||||
jest.spyOn(flipperCommon, 'uuid').mockImplementation(() => fakeUuid);
|
||||
|
||||
// We provide an invalid path to force write stream to fail
|
||||
await commandDownloadFileStart(fakeDownloadURL, '');
|
||||
|
||||
@@ -12,8 +12,7 @@ import iosUtil from './iOSContainerUtility';
|
||||
|
||||
import child_process from 'child_process';
|
||||
import type {IOSDeviceParams} from 'flipper-common';
|
||||
import {DeviceType} from 'flipper-common';
|
||||
import {v1 as uuid} from 'uuid';
|
||||
import {DeviceType, uuid} from 'flipper-common';
|
||||
import path from 'path';
|
||||
import {exec, execFile} from 'promisify-child-process';
|
||||
import {getFlipperServerConfig} from '../../FlipperServerConfig';
|
||||
|
||||
Reference in New Issue
Block a user