mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
lift out ShimRCTInstance to RCTTestUtils (#37859)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37859 Changelog: [Internal] as title Reviewed By: cipolleschi Differential Revision: D46547014 fbshipit-source-id: ca89d659d24fa0fcef1c39fc47fc758cee34f7d8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
03c978d2cc
commit
be2b0e2d8a
@@ -7,7 +7,7 @@
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import <RCTTestUtils/RCTSwizzleHelpers.h>
|
||||
#import <RCTTestUtils/ShimRCTInstance.h>
|
||||
#import <ReactCommon/RCTHermesInstance.h>
|
||||
#import <ReactCommon/RCTHost.h>
|
||||
#import <ReactCommon/RCTInstance.h>
|
||||
@@ -15,9 +15,6 @@
|
||||
|
||||
#import <OCMock/OCMock.h>
|
||||
|
||||
@interface ShimRCTInstance : NSObject
|
||||
@end
|
||||
|
||||
@interface RCTHostTests : XCTestCase
|
||||
@end
|
||||
|
||||
@@ -50,29 +47,3 @@ static ShimRCTInstance *shimmedRCTInstance;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ShimRCTInstance
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
RCTSwizzleInstanceSelector(
|
||||
[RCTInstance class],
|
||||
[ShimRCTInstance class],
|
||||
@selector(initWithDelegate:
|
||||
jsEngineInstance:bundleManager:turboModuleManagerDelegate:onInitialBundleLoad:moduleRegistry:));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
|
||||
jsEngineInstance:(std::shared_ptr<facebook::react::JSEngineInstance>)jsEngineInstance
|
||||
bundleManager:(RCTBundleManager *)bundleManager
|
||||
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)tmmDelegate
|
||||
onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad
|
||||
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface ShimRCTInstance : NSObject
|
||||
@end
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "ShimRCTInstance.h"
|
||||
|
||||
#import <ReactCommon/RCTInstance.h>
|
||||
|
||||
#import "RCTSwizzleHelpers.h"
|
||||
|
||||
@implementation ShimRCTInstance
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
RCTSwizzleInstanceSelector(
|
||||
[RCTInstance class],
|
||||
[ShimRCTInstance class],
|
||||
@selector(initWithDelegate:
|
||||
jsEngineInstance:bundleManager:turboModuleManagerDelegate:onInitialBundleLoad:moduleRegistry:));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
|
||||
jsEngineInstance:(std::shared_ptr<facebook::react::JSEngineInstance>)jsEngineInstance
|
||||
bundleManager:(RCTBundleManager *)bundleManager
|
||||
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)tmmDelegate
|
||||
onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad
|
||||
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user