Skip to content

Commit 291b9cf

Browse files
committed
adding test (not sure it's correct)
1 parent 98c8949 commit 291b9cf

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

scripts/cocoapods/__tests__/utils-test.rb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,44 @@ def test_fixReactBridgingHeaderSearchPaths_correctlySetsTheHeaderSearchPathsForA
382382
end
383383
end
384384

385+
# ===================================== #
386+
# Test - Apply Xcode14 React-Core patch #
387+
# ===================================== #
388+
389+
def test_turnOffResourceBundleReactCore_correctlyAppliesPatch
390+
# Arrange
391+
react_core_debug_config = prepare_Code_Signing_YES_build_configuration("Debug")
392+
react_core_release_config = prepare_Code_Signing_YES_build_configuration("Release")
393+
394+
user_project_mock = UserProjectMock.new("a/path", [
395+
prepare_config("Debug"),
396+
prepare_config("Release"),
397+
])
398+
399+
pods_projects_mock = PodsProjectMock.new([],
400+
{
401+
"hermes-engine" => {},
402+
"React-Core" => [ react_core_debug_config, react_core_release_config ],
403+
})
404+
405+
installer = InstallerMock.new(pods_projects_mock, [
406+
AggregatedProjectMock.new(user_project_mock)
407+
])
408+
409+
# Act
410+
ReactNativePodsUtils.turn_off_resource_bundle_react_core(installer)
411+
412+
# Assert
413+
# something like this?
414+
# assert_equal(pods_projects_mock.build_settings['CODE_SIGNING_ALLOWED'], "NO")
415+
416+
user_project_mock.native_targets.each do |target|
417+
target.build_configurations.each do |config|
418+
assert_equal(config.build_configurations['CODE_SIGNING_ALLOWED'], "NO")
419+
end
420+
end
421+
end
422+
385423
# ================================= #
386424
# Test - Apply Mac Catalyst Patches #
387425
# ================================= #
@@ -502,3 +540,9 @@ def prepare_target(name, product_type = nil)
502540
prepare_config("Release")
503541
], product_type)
504542
end
543+
544+
def prepare_Code_Signing_YES_build_configuration(name)
545+
return BuildConfigurationMock.new(name, {
546+
"CODE_SIGNING_ALLOWED" => "YES"
547+
})
548+
end

0 commit comments

Comments
 (0)