Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Set flipperLib implementation automatically in unit tests
Browse files Browse the repository at this point in the history
Summary: This way plugins get something meaningful when they call `getFlipperLib()` in their tests

Reviewed By: LukeDefeo

Differential Revision: D44662821

fbshipit-source-id: c13800f9d8e905ae4a89955f2186adb816730b77
  • Loading branch information
aigoncharov authored and facebook-github-bot committed Apr 4, 2023
1 parent b3307ba commit f8a1f38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions desktop/flipper-plugin/src/test-utils/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
createState,
TestUtils,
_StartPluginOptions,
_setFlipperLibImplementation,
} from 'flipper-plugin-core';
import {SandyPluginRenderer} from '../plugin/PluginRenderer';
import {DeviceLogEntry} from 'flipper-common';
Expand Down Expand Up @@ -227,6 +228,8 @@ export function startPlugin<Module extends _FlipperPluginModule<any>>(

const serverAddOnControls = createServerAddOnControlsMock();

_setFlipperLibImplementation(flipperUtils);

const pluginInstance = new _SandyPluginInstance(
serverAddOnControls,
flipperUtils,
Expand Down Expand Up @@ -313,6 +316,9 @@ export function startDevicePlugin<Module extends _FlipperDevicePluginModule>(
const flipperLib = TestUtils.createMockFlipperLib(options);
const testDevice = createMockDevice(options);
const serverAddOnControls = createServerAddOnControlsMock();

_setFlipperLibImplementation(flipperLib);

const pluginInstance = new _SandyDevicePluginInstance(
serverAddOnControls,
flipperLib,
Expand Down

0 comments on commit f8a1f38

Please sign in to comment.