fix RCTBundleURLProviderTests
Summary: a year ago or so, there was a change that updated the way RCTBundleURLProvider creates the IP url depending on if HERMES_BYTECODE_VERSION existed, and this test was never updated, so fixing it accordingly Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D32638669 fbshipit-source-id: 3824b90570f60ad5299939b09b99fb56d2b3ddaa
This commit is contained in:
Родитель
1542f83527
Коммит
6957b79105
|
@ -1,3 +1,4 @@
|
|||
load("@fbsource//xplat/hermes/defs:hermes.bzl", "HERMES_BYTECODE_VERSION")
|
||||
load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
|
||||
load("//tools/build_defs:fb_xplat_platform_specific_rule.bzl", "fb_xplat_platform_specific_rule")
|
||||
load("//tools/build_defs:fb_xplat_resource.bzl", "fb_xplat_resource")
|
||||
|
@ -121,7 +122,9 @@ fb_apple_test(
|
|||
"QuartzCore",
|
||||
"UIKit",
|
||||
],
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
|
||||
preprocessor_flags = get_objc_arc_preprocessor_flags() + [
|
||||
"-DHERMES_BYTECODE_VERSION={}".format(HERMES_BYTECODE_VERSION),
|
||||
] + get_preprocessor_flags_for_build_mode(),
|
||||
visibility = [
|
||||
"//fbobjc/Libraries/FBReactKit:workspace",
|
||||
],
|
||||
|
|
|
@ -22,22 +22,42 @@ static NSURL *mainBundleURL()
|
|||
|
||||
static NSURL *localhostBundleURL()
|
||||
{
|
||||
#ifdef HERMES_BYTECODE_VERSION
|
||||
return [NSURL
|
||||
URLWithString:
|
||||
[NSString
|
||||
stringWithFormat:
|
||||
@"http://localhost:8081/%@.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&runtimeBytecodeVersion=%u&app=com.apple.dt.xctest.tool",
|
||||
testFile,
|
||||
HERMES_BYTECODE_VERSION]];
|
||||
#else
|
||||
return [NSURL
|
||||
URLWithString:
|
||||
[NSString
|
||||
stringWithFormat:
|
||||
@"http://localhost:8081/%@.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.apple.dt.xctest.tool",
|
||||
testFile]];
|
||||
#endif
|
||||
}
|
||||
|
||||
static NSURL *ipBundleURL()
|
||||
{
|
||||
#ifdef HERMES_BYTECODE_VERSION
|
||||
return [NSURL
|
||||
URLWithString:
|
||||
[NSString
|
||||
stringWithFormat:
|
||||
@"http://192.168.1.1:8081/%@.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&runtimeBytecodeVersion=%u&app=com.apple.dt.xctest.tool",
|
||||
testFile,
|
||||
HERMES_BYTECODE_VERSION]];
|
||||
#else
|
||||
return [NSURL
|
||||
URLWithString:
|
||||
[NSString
|
||||
stringWithFormat:
|
||||
@"http://192.168.1.1:8081/%@.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.apple.dt.xctest.tool",
|
||||
testFile]];
|
||||
#endif
|
||||
}
|
||||
|
||||
@implementation NSBundle (RCTBundleURLProviderTests)
|
||||
|
@ -88,6 +108,8 @@ static NSURL *ipBundleURL()
|
|||
|
||||
- (void)testLocalhostURL
|
||||
{
|
||||
id classMock = OCMClassMock([RCTBundleURLProvider class]);
|
||||
[[[classMock stub] andReturnValue:@YES] isPackagerRunning:[OCMArg any] scheme:[OCMArg any]];
|
||||
RCTBundleURLProvider *settings = [RCTBundleURLProvider sharedSettings];
|
||||
settings.jsLocation = @"localhost";
|
||||
NSURL *URL = [settings jsBundleURLForBundleRoot:testFile fallbackResource:nil];
|
||||
|
|
Загрузка…
Ссылка в новой задаче