diff --git a/docs/extending/testing.mdx b/docs/extending/testing.mdx index 40dd6c945..c21681bea 100644 --- a/docs/extending/testing.mdx +++ b/docs/extending/testing.mdx @@ -3,10 +3,18 @@ id: testing title: Testing --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import {FbInternalOnly, OssOnly} from 'internaldocs-fb-helpers'; +import FbIosTesting from '../fb/ios-plugin-development-testing-ios-plugins-0.mdx'; +import FbAndroidTesting from '../fb/android-plugin-development-testing-android-plugins-0.mdx'; + Developer tools are only used if they work. We have built APIs to test plugins. -## Android + + + Start by creating your first test file in this directory `MyFlipperPluginTest.java`. In the test method body we create our plugin which we want to test as well as a `FlipperConnectionMock`. In this contrived example we simply assert that our plugin's connected status is what we expect. ```java @@ -46,8 +54,14 @@ public void myTest() { .build())); } ``` + -## C++ + + + + + + Start by creating your first test file in this directory `MyFlipperPluginTests.cpp` and import the testing utilities from `fbsource//xplat/sonar/xplat:FlipperTestLib`. These utilities mock out core pieces of the communication channel so that you can test your plugin in isolation. @@ -93,7 +107,9 @@ TEST(MyFlipperPluginTests, testDummy) { EXPECT_EQ(successfulResponses.back(), expectedResponse); } ``` + -## Testing the Flipper Desktop Plugin + -See the [tutorial](../tutorial/js-custom#testing-plugin-logic) + + diff --git a/website/sidebars.js b/website/sidebars.js index b23a6cf94..966a87184 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -105,13 +105,11 @@ module.exports = { { Android: [ 'fb/android-plugin-development-Android-interacting-0', - 'fb/android-plugin-development-testing-android-plugins-0', ], }, { iOS: [ 'fb/ios-plugin-development-sending-data-to-an-ios-plugin-0', - 'fb/ios-plugin-development-testing-ios-plugins-0', ], }, ]),