From 46e86dca876f82e24d2a63604801b4c356d786aa Mon Sep 17 00:00:00 2001 From: Edmond Chui Date: Mon, 27 Jan 2025 05:53:15 -0800 Subject: [PATCH] Update tests to support new didOpen delegate fn Summary: Changelog: [General][Fixed] Update tests to support new `didOpen` delegate fn Add support for the new `didOpen` delegate function in tests. To follow up separately: the borked tear down sequence when these two tests are ran together (they pass when ran individually) ``` buck2 test @//fbobjc/mode/buck2/ios-tests fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/jsinspector-modern:testsAppleMac -- ReactInstanceIntegrationTest RuntimeTargetDebuggerSessionObserverTest ``` Reviewed By: hoxyq Differential Revision: D68632974 fbshipit-source-id: 59da6d9e2d09f2c7e219c1902dd6f9b8ddfee9dc --- .../tests/InspectorPackagerConnectionTest.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp index 0823d66beee..22d940d8ac3 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include "FollyDynamicMatchers.h" @@ -42,10 +41,15 @@ class InspectorPackagerConnectionTestBase : public testing::Test { "my-device", "my-app", packagerConnectionDelegates_.make_unique(asyncExecutor_)}) { + auto makeSocket = webSockets_.lazily_make_unique< + const std::string&, + std::weak_ptr>(); ON_CALL(*packagerConnectionDelegate(), connectWebSocket(_, _)) - .WillByDefault(webSockets_.lazily_make_unique< - const std::string&, - std::weak_ptr>()); + .WillByDefault([makeSocket](auto&&... args) { + auto socket = makeSocket(std::forward(args)...); + socket->getDelegate().didOpen(); + return std::move(socket); + }); } void TearDown() override {