support createPaste
Summary: Added support for `createPaste` in Sandy plugins Nice minimalistic example of how to expose a Flipper api to Sandy. Note that some indirection could be removed by having an interface that is shared directly between `BasePluginClient` and `FlipperLib` (e.g. `PublicFlipperLib`). In contrast to `addMenuEntries` from the previous diff, `createPaste` is basically exposed verbatim to Sandy without additional wrapping, so those cases could be made simpler. Maybe will do that later. Reviewed By: passy Differential Revision: D22815873 fbshipit-source-id: e6d0773a35341edfe5de0898317eaadf88de79d0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9c202a4a10
commit
7c6065889d
@@ -328,3 +328,21 @@ test('plugins can register menu entries', async () => {
|
||||
`"No menu entry found with action: Non Existing"`,
|
||||
);
|
||||
});
|
||||
|
||||
test('plugins can create pastes', async () => {
|
||||
const plugin = TestUtils.startPlugin({
|
||||
plugin(client: PluginClient) {
|
||||
return {
|
||||
doIt() {
|
||||
client.createPaste('test');
|
||||
},
|
||||
};
|
||||
},
|
||||
Component() {
|
||||
return null;
|
||||
},
|
||||
});
|
||||
|
||||
plugin.instance.doIt();
|
||||
expect(plugin.flipperLib.createPaste).toBeCalledWith('test');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user