Fix bug causing archived devices trying to connect

Reviewed By: nikoant

Differential Revision: D28064540

fbshipit-source-id: 43f05c4348a33e9633751bb9f69cd8d17ddd13c4
This commit is contained in:
Michel Weststrate
2021-04-29 12:12:00 -07:00
committed by Facebook GitHub Bot
parent 8a3ba8615d
commit 699343a9ca
7 changed files with 325 additions and 18 deletions

View File

@@ -62,6 +62,7 @@ type MockOptions = Partial<{
asBackgroundPlugin?: true;
supportedPlugins?: string[];
device?: BaseDevice;
archivedDevice?: boolean;
}>;
function isPluginEnabled(
@@ -90,7 +91,8 @@ export async function createMockFlipperWithPlugin(
const logger = mockFlipper.logger;
const store = mockFlipper.store;
const createDevice = (serial: string) => mockFlipper.createDevice({serial});
const createDevice = (serial: string, archived?: boolean) =>
mockFlipper.createDevice({serial, archived});
const createClient = async (
device: BaseDevice,
name: string,
@@ -131,7 +133,7 @@ export async function createMockFlipperWithPlugin(
const device = options?.device
? mockFlipper.loadDevice(options?.device)
: createDevice('serial');
: createDevice('serial', options?.archivedDevice);
const client = await createClient(device, 'TestApp');
store.dispatch(selectDevice(device));