File tree Expand file tree Collapse file tree
packages/react-native/scripts/cocoapods/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2+ #
3+ # This source code is licensed under the MIT license found in the
4+ # LICENSE file in the root directory of this source tree.
5+
6+ require "test/unit"
7+ require_relative "../utils.rb"
8+ require_relative "../../../sdks/hermes-engine/hermes-utils.rb"
9+
10+ class MavenCacheFlagTests < Test ::Unit ::TestCase
11+ def setup
12+ @original_value = ENV [ 'RCT_REACT_NATIVE_MAVEN_CACHE_ENABLED' ]
13+ ENV . delete ( 'RCT_REACT_NATIVE_MAVEN_CACHE_ENABLED' )
14+ end
15+
16+ def teardown
17+ if @original_value == nil
18+ ENV . delete ( 'RCT_REACT_NATIVE_MAVEN_CACHE_ENABLED' )
19+ else
20+ ENV [ 'RCT_REACT_NATIVE_MAVEN_CACHE_ENABLED' ] = @original_value
21+ end
22+ end
23+
24+ def test_mavenCache_isDisabledByDefault
25+ assert_false ( ReactNativePodsUtils . react_native_maven_cache_enabled? )
26+ assert_false ( react_native_maven_cache_enabled? )
27+ end
28+
29+ def test_mavenCache_isEnabledWhenExplicitlySetToTrue
30+ ENV [ 'RCT_REACT_NATIVE_MAVEN_CACHE_ENABLED' ] = 'true'
31+
32+ assert_true ( ReactNativePodsUtils . react_native_maven_cache_enabled? )
33+ assert_true ( react_native_maven_cache_enabled? )
34+ end
35+
36+ def test_mavenCache_isDisabledWhenExplicitlySetToFalse
37+ ENV [ 'RCT_REACT_NATIVE_MAVEN_CACHE_ENABLED' ] = 'false'
38+
39+ assert_false ( ReactNativePodsUtils . react_native_maven_cache_enabled? )
40+ assert_false ( react_native_maven_cache_enabled? )
41+ end
42+ end
You can’t perform that action at this time.
0 commit comments