Delete skipped legacy-bridge unit tests (#59321)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59321

RCTModuleInitTests and RCTModuleInitNotificationRaceTests skip every
test since they rely on the removed bridge. RCTAllocationTests keeps
only its live module-method deallocation test. Remove the dead files
from the Xcode project.

Changelog:
[Internal]

Reviewed By: shwanton

Differential Revision: D126581181

fbshipit-source-id: 8cae13ba423395285b96c4aec8eaeec606d3f756
This commit is contained in:
Christoph Purrer authored and meta-codesync[bot] committed 2026-10-22 21:54:34 -07:00
1 parent c7f65541b8
commit 2b71bb2a7f
4 files changed
+3 -524

No files matched your search

@@ -26,11 +26,9 @@
E62F11842A5C6584000BF1C8 /* UpdatePropertiesExampleView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.mm */; };
E7C1241A22BEC44B00DA25C0 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */; };
E7DB20D122B2BAA6005AC45F /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */; };
E7DB20D222B2BAA6005AC45F /* RCTModuleInitNotificationRaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */; };
E7DB20D322B2BAA6005AC45F /* RCTBlobManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */; };
E7DB20D522B2BAA6005AC45F /* RCTPerformanceLoggerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */; };
E7DB20D622B2BAA6005AC45F /* RCTFontTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */; };
E7DB20D722B2BAA6005AC45F /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B022B2BAA4005AC45F /* RCTModuleInitTests.m */; };
E7DB20D822B2BAA6005AC45F /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */; };
E7DB20D922B2BAA6005AC45F /* RCTAnimationUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */; };
E7DB20DA22B2BAA6005AC45F /* RNTesterUnitTestsBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = E7DB20B322B2BAA4005AC45F /* RNTesterUnitTestsBundle.js */; };
@@ -112,12 +110,10 @@
E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
E7DB20A322B2BA84005AC45F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProviderTests.m; sourceTree = "<group>"; };
E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitNotificationRaceTests.m; sourceTree = "<group>"; };
E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBlobManagerTests.m; sourceTree = "<group>"; };
E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPerformanceLoggerTests.m; sourceTree = "<group>"; };
E7DB20AE22B2BAA4005AC45F /* RCTImageLoaderHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageLoaderHelpers.h; sourceTree = "<group>"; };
E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFontTests.m; sourceTree = "<group>"; };
E7DB20B022B2BAA4005AC45F /* RCTModuleInitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitTests.m; sourceTree = "<group>"; };
E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSONTests.m; sourceTree = "<group>"; };
E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimationUtilsTests.m; sourceTree = "<group>"; };
E7DB20B322B2BAA4005AC45F /* RNTesterUnitTestsBundle.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = RNTesterUnitTestsBundle.js; sourceTree = "<group>"; };
@@ -341,8 +337,6 @@
E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */,
E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */,
E7DB20C322B2BAA4005AC45F /* RCTMethodArgumentTests.m */,
E7DB20AA22B2BAA3005AC45F /* RCTModuleInitNotificationRaceTests.m */,
E7DB20B022B2BAA4005AC45F /* RCTModuleInitTests.m */,
E7DB20CB22B2BAA5005AC45F /* RCTModuleMethodTests.mm */,
F1A0B1C23D4E5F6071829301 /* RCTTurboModuleArrayBufferTests.mm */,
E7DB20CF22B2BAA5005AC45F /* RCTMultipartStreamReaderTests.m */,
@@ -754,7 +748,6 @@
files = (
A975CA6C2C05EADF0043F72A /* RCTNetworkTaskTests.m in Sources */,
E7DB20DF22B2BAA6005AC45F /* RCTImageLoaderTests.m in Sources */,
E7DB20D222B2BAA6005AC45F /* RCTModuleInitNotificationRaceTests.m in Sources */,
E7DB20D522B2BAA6005AC45F /* RCTPerformanceLoggerTests.m in Sources */,
E7DB20D922B2BAA6005AC45F /* RCTAnimationUtilsTests.m in Sources */,
E7DB20D122B2BAA6005AC45F /* RCTBundleURLProviderTests.m in Sources */,
@@ -772,7 +765,6 @@
E7DB20DB22B2BAA6005AC45F /* RCTNativeAnimatedNodesManagerTests.m in Sources */,
E7DB20E722B2BAA6005AC45F /* RCTConvert_NSURLTests.m in Sources */,
E7DB20EA22B2BAA6005AC45F /* RCTImageUtilTests.m in Sources */,
E7DB20D722B2BAA6005AC45F /* RCTModuleInitTests.m in Sources */,
D1A60AD11B9247A080734F02 /* RCTDevLoadingViewTests.m in Sources */,
E7DB20E522B2BAA6005AC45F /* RCTDevMenuTests.m in Sources */,
E7DB20DE22B2BAA6005AC45F /* RCTUnicodeDecodeTests.m in Sources */,
@@ -9,10 +9,9 @@
#import <XCTest/XCTest.h>
#import <RCTTest/RCTTestRunner.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTInvalidating.h>
#import <React/RCTModuleMethod.h>
#import <React/RCTRootView.h>
@interface AllocationTestModule : NSObject <RCTBridgeModule, RCTInvalidating>
@@ -48,97 +47,7 @@ RCT_EXPORT_METHOD(
@interface RCTAllocationTests : XCTestCase
@end
@implementation RCTAllocationTests {
NSURL *_bundleURL;
}
- (void)setUp
{
[super setUp];
NSString *bundleContents =
@"var __fbBatchedBridge = {"
" callFunctionReturnFlushedQueue: function() { return null; },"
" invokeCallbackAndReturnFlushedQueue: function() { return null; },"
" flushedQueue: function() { return null; },"
"};";
NSURL *tempDir = [NSURL fileURLWithPath:NSTemporaryDirectory() isDirectory:YES];
[[NSFileManager defaultManager] createDirectoryAtURL:tempDir
withIntermediateDirectories:YES
attributes:nil
error:NULL];
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
NSString *fileName = [NSString stringWithFormat:@"rctallocationtests-bundle-%@.js", guid];
_bundleURL = [tempDir URLByAppendingPathComponent:fileName];
NSError *saveError;
if (![bundleContents writeToURL:_bundleURL atomically:YES encoding:NSUTF8StringEncoding error:&saveError]) {
XCTFail(@"Failed to save test bundle to %@, error: %@", _bundleURL, saveError);
};
}
- (void)tearDown
{
[super tearDown];
[[NSFileManager defaultManager] removeItemAtURL:_bundleURL error:NULL];
}
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testBridgeIsDeallocated
{
__weak RCTBridge *weakBridge;
@autoreleasepool {
RCTRootView *view = [[RCTRootView alloc] initWithBundleURL:_bundleURL
moduleName:@""
initialProperties:nil
launchOptions:nil];
weakBridge = view.bridge;
XCTAssertNotNil(weakBridge, @"RCTBridge should have been created");
(void)view;
}
XCTAssertNil(weakBridge, @"RCTBridge should have been deallocated");
}
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testModulesAreInvalidated
{
AllocationTestModule *module = [AllocationTestModule new];
@autoreleasepool {
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL
moduleProvider:^{
return @[ module ];
}
launchOptions:nil];
XCTAssertTrue(module.isValid, @"AllocationTestModule should be valid");
(void)bridge;
}
RCT_RUN_RUNLOOP_WHILE(module.isValid)
XCTAssertFalse(module.isValid, @"AllocationTestModule should have been invalidated by the bridge");
}
// disabled_Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testModulesAreDeallocated
{
__weak AllocationTestModule *weakModule;
@autoreleasepool {
AllocationTestModule *module = [AllocationTestModule new];
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL
moduleProvider:^{
return @[ module ];
}
launchOptions:nil];
XCTAssertNotNil(module, @"AllocationTestModule should have been created");
weakModule = module;
(void)bridge;
}
RCT_RUN_RUNLOOP_WHILE(weakModule)
XCTAssertNil(weakModule, @"AllocationTestModule should have been deallocated");
}
@implementation RCTAllocationTests
- (void)testModuleMethodsAreDeallocated
{
@@ -159,58 +68,4 @@ RCT_EXPORT_METHOD(
XCTAssertNil(weakMethod, @"RCTModuleMethod should have been deallocated");
}
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testContentViewIsInvalidated
{
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:nil launchOptions:nil];
__weak UIView *rootContentView;
@autoreleasepool {
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"" initialProperties:nil];
RCT_RUN_RUNLOOP_WHILE(!(rootContentView = [rootView valueForKey:@"contentView"]))
XCTAssertTrue(rootContentView.userInteractionEnabled, @"RCTContentView should be valid");
(void)rootView;
}
#if !TARGET_OS_TV // userInteractionEnabled is true for Apple TV views
XCTAssertFalse(rootContentView.userInteractionEnabled, @"RCTContentView should have been invalidated");
#endif
}
/**
* T42930872:
*
* Both bridge invalidation and bridge setUp occur execute concurrently.
* Therefore, it's not safe for us to create a bridge, and immediately reload on
* it. It's also unsafe to just reload the bridge, because that calls invalidate
* and then setUp. Because of these race conditions, this test may randomly
* crash. Hence, we should disable this test until we either fix the bridge
* or delete it.
*/
- (void)disabled_testUnderlyingBridgeIsDeallocated
{
RCTBridge *bridge;
__weak id batchedBridge;
@autoreleasepool {
bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:nil launchOptions:nil];
batchedBridge = bridge.batchedBridge;
XCTAssertTrue([batchedBridge isValid], @"RCTBridge impl should be valid");
[bridge reload];
}
RCT_RUN_RUNLOOP_WHILE(batchedBridge != nil)
XCTAssertNotNil(bridge, @"RCTBridge should not have been deallocated");
XCTAssertNil(batchedBridge, @"RCTBridge impl should have been deallocated");
// Wait to complete the test until the new bridge impl is also deallocated
@autoreleasepool {
batchedBridge = bridge.batchedBridge;
[bridge invalidate];
bridge = nil;
}
RCT_RUN_RUNLOOP_WHILE(batchedBridge != nil);
XCTAssertNil(batchedBridge);
}
@end
@@ -1,116 +0,0 @@
/*
* 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>
#import <XCTest/XCTest.h>
#import <RCTTest/RCTTestRunner.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTInitializing.h>
#import <React/RCTJavaScriptExecutor.h>
#import <React/RCTUIManager.h>
#import <React/RCTViewManager.h>
@interface RCTTestViewManager : RCTViewManager
@end
@implementation RCTTestViewManager
RCT_EXPORT_MODULE()
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
- (NSArray<NSString *> *)customBubblingEventTypes
{
return @[ @"foo" ];
}
#pragma clang diagnostic pop
@end
@interface RCTNotificationObserverModule : NSObject <RCTBridgeModule, RCTInitializing>
@property (nonatomic, assign) BOOL didDetectViewManagerInit;
@end
@implementation RCTNotificationObserverModule
@synthesize bridge = _bridge;
RCT_EXPORT_MODULE()
- (void)initialize
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didInitViewManager:)
name:RCTDidInitializeModuleNotification
object:nil];
}
- (void)didInitViewManager:(NSNotification *)note
{
id<RCTBridgeModule> module = note.userInfo[@"module"];
if ([module isKindOfClass:[RCTTestViewManager class]]) {
_didDetectViewManagerInit = YES;
}
}
@end
@interface RCTModuleInitNotificationRaceTests : XCTestCase <RCTBridgeDelegate> {
RCTBridge *_bridge;
RCTNotificationObserverModule *_notificationObserver;
}
@end
@implementation RCTModuleInitNotificationRaceTests
- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
{
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
return [bundle URLForResource:@"RNTesterUnitTestsBundle" withExtension:@"js"];
}
- (NSArray *)extraModulesForBridge:(__unused RCTBridge *)bridge
{
return @[ [RCTTestViewManager new], _notificationObserver ];
}
- (void)setUp
{
[super setUp];
XCTSkip(@"Skipping RCTModuleInitNotificationRaceTests since they rely on deprecated RCTBridge functionality.");
_notificationObserver = [RCTNotificationObserverModule new];
_bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
dispatch_async(dispatch_get_main_queue(), ^{
[[self->_bridge uiManager] constantsToExport];
});
}
- (void)tearDown
{
[super tearDown];
_notificationObserver = nil;
[_bridge invalidate];
_bridge = nil;
}
- (void)testViewManagerNotInitializedBeforeSetBridgeModule
{
RCT_RUN_RUNLOOP_WHILE(!_notificationObserver.didDetectViewManagerInit);
}
@end
@@ -1,252 +0,0 @@
/*
* 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>
#import <XCTest/XCTest.h>
#import <RCTTest/RCTTestRunner.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTInitializing.h>
#import <React/RCTJavaScriptExecutor.h>
#import <React/RCTUtils.h>
@interface RCTTestInjectedModule : NSObject <RCTBridgeModule>
@end
@implementation RCTTestInjectedModule
@synthesize bridge = _bridge;
@synthesize methodQueue = _methodQueue;
RCT_EXPORT_MODULE()
@end
@interface RCTTestCustomInitModule : NSObject <RCTBridgeModule>
@property (nonatomic, assign) BOOL initializedOnMainQueue;
@end
@implementation RCTTestCustomInitModule
@synthesize bridge = _bridge;
@synthesize methodQueue = _methodQueue;
RCT_EXPORT_MODULE()
- (id)init
{
if ((self = [super init])) {
_initializedOnMainQueue = RCTIsMainQueue();
}
return self;
}
@end
@interface RCTTestCustomSetBridgeModule : NSObject <RCTBridgeModule, RCTInitializing>
@property (nonatomic, assign) BOOL setBridgeOnMainQueue;
@end
@implementation RCTTestCustomSetBridgeModule
@synthesize bridge = _bridge;
@synthesize methodQueue = _methodQueue;
RCT_EXPORT_MODULE()
- (void)initialize
{
_setBridgeOnMainQueue = RCTIsMainQueue();
}
@end
@interface RCTTestExportConstantsModule : NSObject <RCTBridgeModule>
@property (nonatomic, assign) BOOL exportedConstants;
@property (nonatomic, assign) BOOL exportedConstantsOnMainQueue;
@end
@implementation RCTTestExportConstantsModule
@synthesize bridge = _bridge;
@synthesize methodQueue = _methodQueue;
RCT_EXPORT_MODULE()
- (NSDictionary<NSString *, id> *)constantsToExport
{
return [self getConstants];
}
- (NSDictionary<NSString *, id> *)getConstants
{
_exportedConstants = YES;
_exportedConstantsOnMainQueue = RCTIsMainQueue();
return @{@"foo" : @"bar"};
}
@end
@interface RCTLazyInitModule : NSObject <RCTBridgeModule>
@end
@implementation RCTLazyInitModule
@synthesize bridge = _bridge;
@synthesize methodQueue = _methodQueue;
RCT_EXPORT_MODULE()
@end
@interface RCTModuleInitTests : XCTestCase <RCTBridgeDelegate> {
RCTBridge *_bridge;
BOOL _injectedModuleInitNotificationSent;
BOOL _customInitModuleNotificationSent;
BOOL _customSetBridgeModuleNotificationSent;
BOOL _exportConstantsModuleNotificationSent;
BOOL _lazyInitModuleNotificationSent;
BOOL _lazyInitModuleNotificationSentOnMainQueue;
BOOL _viewManagerModuleNotificationSent;
RCTTestInjectedModule *_injectedModule;
}
@end
@implementation RCTModuleInitTests
- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
{
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
return [bundle URLForResource:@"RNTesterUnitTestsBundle" withExtension:@"js"];
}
- (NSArray *)extraModulesForBridge:(__unused RCTBridge *)bridge
{
return @[ _injectedModule ];
}
- (void)setUp
{
[super setUp];
XCTSkip(@"Skipping RCTModuleInitTests since they rely on deprecated RCTBridge functionality.");
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moduleDidInit:)
name:RCTDidInitializeModuleNotification
object:nil];
_injectedModuleInitNotificationSent = NO;
_customInitModuleNotificationSent = NO;
_customSetBridgeModuleNotificationSent = NO;
_exportConstantsModuleNotificationSent = NO;
_lazyInitModuleNotificationSent = NO;
_viewManagerModuleNotificationSent = NO;
_injectedModule = [RCTTestInjectedModule new];
_bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
}
- (void)tearDown
{
[super tearDown];
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTDidInitializeModuleNotification object:nil];
[_bridge invalidate];
_bridge = nil;
}
- (void)moduleDidInit:(NSNotification *)note
{
id<RCTBridgeModule> module = note.userInfo[@"module"];
if ([module isKindOfClass:[RCTTestInjectedModule class]]) {
_injectedModuleInitNotificationSent = YES;
} else if ([module isKindOfClass:[RCTTestCustomInitModule class]]) {
_customInitModuleNotificationSent = YES;
} else if ([module isKindOfClass:[RCTTestCustomSetBridgeModule class]]) {
_customSetBridgeModuleNotificationSent = YES;
} else if ([module isKindOfClass:[RCTTestExportConstantsModule class]]) {
_exportConstantsModuleNotificationSent = YES;
} else if ([module isKindOfClass:[RCTLazyInitModule class]]) {
_lazyInitModuleNotificationSent = YES;
_lazyInitModuleNotificationSentOnMainQueue = RCTIsMainQueue();
}
}
- (void)testInjectedModulesInitializedDuringBridgeInit
{
XCTAssertEqual(_injectedModule, [_bridge moduleForClass:[RCTTestInjectedModule class]]);
XCTAssertEqual(_injectedModule.bridge, _bridge.batchedBridge);
XCTAssertNotNil(_injectedModule.methodQueue);
RCT_RUN_RUNLOOP_WHILE(!_injectedModuleInitNotificationSent);
XCTAssertTrue(_injectedModuleInitNotificationSent);
}
- (void)testCustomInitModuleInitializedAtBridgeStartup
{
RCT_RUN_RUNLOOP_WHILE(!_customInitModuleNotificationSent);
XCTAssertTrue(_customInitModuleNotificationSent);
RCTTestCustomInitModule *module = [_bridge moduleForClass:[RCTTestCustomInitModule class]];
XCTAssertTrue(module.initializedOnMainQueue);
XCTAssertEqual(module.bridge, _bridge.batchedBridge);
XCTAssertNotNil(module.methodQueue);
}
- (void)testCustomSetBridgeModuleInitializedAtBridgeStartup
{
XCTAssertFalse(_customSetBridgeModuleNotificationSent);
__block RCTTestCustomSetBridgeModule *module;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
module = [self->_bridge moduleForClass: [RCTTestCustomSetBridgeModule class]];
});
RCT_RUN_RUNLOOP_WHILE(!module);
XCTAssertTrue(_customSetBridgeModuleNotificationSent);
XCTAssertFalse(module.setBridgeOnMainQueue);
XCTAssertEqual(module.bridge, _bridge.batchedBridge);
XCTAssertNotNil(module.methodQueue);
}
- (void)testExportConstantsModuleInitializedAtBridgeStartup
{
RCT_RUN_RUNLOOP_WHILE(!_exportConstantsModuleNotificationSent);
XCTAssertTrue(_exportConstantsModuleNotificationSent);
RCTTestExportConstantsModule *module = [_bridge moduleForClass:[RCTTestExportConstantsModule class]];
RCT_RUN_RUNLOOP_WHILE(!module.exportedConstants);
XCTAssertTrue(module.exportedConstants);
XCTAssertTrue(module.exportedConstantsOnMainQueue);
XCTAssertEqual(module.bridge, _bridge.batchedBridge);
XCTAssertNotNil(module.methodQueue);
}
- (void)testLazyInitModuleNotInitializedDuringBridgeInit
{
XCTAssertFalse(_lazyInitModuleNotificationSent);
__block RCTLazyInitModule *module;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
module = [self->_bridge moduleForClass: [RCTLazyInitModule class]];
});
RCT_RUN_RUNLOOP_WHILE(!module);
XCTAssertTrue(_lazyInitModuleNotificationSent);
XCTAssertFalse(_lazyInitModuleNotificationSentOnMainQueue);
XCTAssertNotNil(module);
XCTAssertEqual(module.bridge, _bridge.batchedBridge);
XCTAssertNotNil(module.methodQueue);
}
@end