Introduce PluginRenderer to render plugins
Summary: PluginContainer will now wrap Sandy plugins in PluginRenderer. PluginRenderer will also be used by plugin unit tests in the future Reviewed By: jknoxville Differential Revision: D22159359 fbshipit-source-id: 69f9c8f4bec9392022c1d7a14957f5aca0339d97
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ba01fa5bc9
commit
f2c39aed55
@@ -29,11 +29,12 @@ import Client, {ClientQuery} from '../Client';
|
||||
|
||||
import {buildClientId} from '../utils/clientUtils';
|
||||
import {Logger} from '../fb-interfaces/Logger';
|
||||
import {FlipperPlugin, PluginDefinition} from '../plugin';
|
||||
import {PluginDefinition} from '../plugin';
|
||||
import {registerPlugins} from '../reducers/plugins';
|
||||
import PluginContainer from '../PluginContainer';
|
||||
import {getPluginKey} from '../utils/pluginUtils';
|
||||
import {getInstance} from '../fb-stubs/Logger';
|
||||
import {PluginDetails} from 'flipper-plugin-lib';
|
||||
|
||||
type MockFlipperResult = {
|
||||
client: Client;
|
||||
@@ -182,7 +183,7 @@ export async function createMockFlipperWithPlugin(
|
||||
type Renderer = RenderResult<typeof import('testing-library__dom/queries')>;
|
||||
|
||||
export async function renderMockFlipperWithPlugin(
|
||||
pluginClazz: typeof FlipperPlugin,
|
||||
pluginClazz: PluginDefinition,
|
||||
): Promise<
|
||||
MockFlipperResult & {
|
||||
renderer: Renderer;
|
||||
@@ -219,3 +220,21 @@ export async function renderMockFlipperWithPlugin(
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createMockPluginDetails(
|
||||
details?: Partial<PluginDetails>,
|
||||
): PluginDetails {
|
||||
return {
|
||||
id: 'TestPlugin',
|
||||
dir: '',
|
||||
name: 'TestPlugin',
|
||||
specVersion: 0,
|
||||
entry: '',
|
||||
isDefault: false,
|
||||
main: '',
|
||||
source: '',
|
||||
title: 'Testing Plugin',
|
||||
version: '',
|
||||
...details,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user