mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
react_native_pods.rb Add snapshot tests for script_phases scripts
Summary: Changelog: [internal] Adding snapshots for script_phases. These snapshots are taken from working scripts. Reviewed By: cortinico Differential Revision: D33045627 fbshipit-source-id: fbc1e005954cd185fb5f9b48c55a073ad9d5523a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1dbbeb4462
commit
1f350a72f7
@@ -0,0 +1,43 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
def snap_get_script_phases_with_codegen_discovery()
|
||||
return <<~EOS
|
||||
pushd "$PODS_ROOT/../" > /dev/null
|
||||
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
|
||||
popd >/dev/null
|
||||
|
||||
export RCT_SCRIPT_RN_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/../..
|
||||
export RCT_SCRIPT_APP_PATH=$RCT_SCRIPT_POD_INSTALLATION_ROOT/
|
||||
export RCT_SCRIPT_CONFIG_FILE_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/node_modules
|
||||
export RCT_SCRIPT_OUTPUT_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT
|
||||
export RCT_SCRIPT_FABRIC_ENABLED=true
|
||||
export RCT_SCRIPT_TYPE=withCodegenDiscovery
|
||||
|
||||
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
|
||||
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
|
||||
EOS
|
||||
end
|
||||
|
||||
def snap_get_script_phases_no_codegen_discovery()
|
||||
return <<~EOS
|
||||
pushd "$PODS_ROOT/../" > /dev/null
|
||||
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
|
||||
popd >/dev/null
|
||||
|
||||
export RCT_SCRIPT_RN_DIR=${PODS_TARGET_SRCROOT}/../../..
|
||||
export RCT_SCRIPT_LIBRARY_NAME=ScreenshotmanagerSpec
|
||||
export RCT_SCRIPT_OUTPUT_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/build/generated/ios
|
||||
export RCT_SCRIPT_LIBRARY_TYPE=modules
|
||||
export RCT_SCRIPT_JS_SRCS_PATTERN=Native*.js
|
||||
export RCT_SCRIPT_JS_SRCS_DIR=./
|
||||
export RCT_SCRIPT_CODEGEN_MODULE_DIR=.
|
||||
export RCT_SCRIPT_CODEGEN_COMPONENT_DIR=react/renderer/components
|
||||
export RCT_SCRIPT_FILE_LIST=\"[\\\".//NativeScreenshotManager.js\\\"]\"
|
||||
|
||||
SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"
|
||||
/bin/sh -c \"$SCRIPT_PHASES_SCRIPT\"
|
||||
EOS
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
require_relative "../script_phases"
|
||||
require_relative "./script_phases.snap"
|
||||
require 'minitest/autorun'
|
||||
|
||||
class TestScriptPhases < Minitest::Test
|
||||
|
||||
def test_get_script_phases_with_codegen_discovery
|
||||
result = get_script_phases_with_codegen_discovery(
|
||||
react_native_path: '../..',
|
||||
relative_app_root: '',
|
||||
relative_config_file_dir: 'node_modules',
|
||||
fabric_enabled: true)
|
||||
assert_equal snap_get_script_phases_with_codegen_discovery, result
|
||||
end
|
||||
|
||||
def test_get_script_phases_no_codegen_discovery()
|
||||
result = get_script_phases_no_codegen_discovery(
|
||||
react_native_path: '../../..',
|
||||
codegen_output_dir: 'build/generated/ios',
|
||||
codegen_module_dir: '.',
|
||||
codegen_component_dir: 'react/renderer/components',
|
||||
library_name: 'ScreenshotmanagerSpec',
|
||||
library_type: 'modules',
|
||||
js_srcs_pattern: 'Native*.js',
|
||||
js_srcs_dir: './',
|
||||
file_list: '[".//NativeScreenshotManager.js"]'
|
||||
)
|
||||
assert_equal snap_get_script_phases_no_codegen_discovery, result
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user