Skip to content

Commit ba27358

Browse files
committed
Fix tests
1 parent 0ecaed3 commit ba27358

2 files changed

Lines changed: 30 additions & 16 deletions

File tree

packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ class DependencyUtilsTest {
290290
assertThat(forcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" })
291291
.isTrue()
292292
assertThat(forcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" })
293+
.isFalse()
294+
assertThat(forcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" })
293295
.isTrue()
294296
}
295297

@@ -325,10 +327,14 @@ class DependencyUtilsTest {
325327
assertThat(appForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" })
326328
.isTrue()
327329
assertThat(appForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" })
330+
.isFalse()
331+
assertThat(appForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" })
328332
.isTrue()
329333
assertThat(libForcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" })
330334
.isTrue()
331335
assertThat(libForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:4.5.6" })
336+
.isFalse()
337+
assertThat(libForcedModules.any { it.toString() == "com.facebook.hermes:hermes-android:7.8.9" })
332338
.isTrue()
333339
}
334340

@@ -384,12 +390,20 @@ class DependencyUtilsTest {
384390
assertThat(
385391
appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" }
386392
)
393+
.isFalse()
394+
assertThat(
395+
appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" }
396+
)
387397
.isTrue()
388398
assertThat(libForcedModules.any { it.toString() == "io.github.test:react-android:1.2.3" })
389399
.isTrue()
390400
assertThat(
391401
libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" }
392402
)
403+
.isFalse()
404+
assertThat(
405+
libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:7.8.9" }
406+
)
393407
.isTrue()
394408
}
395409

@@ -430,7 +444,7 @@ class DependencyUtilsTest {
430444
}
431445

432446
@Test
433-
fun getDependencySubstitutions_withDefaultGroup_substitutesCorrectly_withClassicHermes() {
447+
fun getDependencySubstitutions_withDefaultGroup_substitutesCorrectly_withHermesV1() {
434448
val dependencySubstitutions =
435449
getDependencySubstitutions(DependencyUtils.Coordinates("0.42.0", "0.42.0", "0.43.0"))
436450

@@ -442,7 +456,7 @@ class DependencyUtilsTest {
442456
)
443457
.isEqualTo(dependencySubstitutions[0].third)
444458
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
445-
assertThat("com.facebook.hermes:hermes-android:0.42.0")
459+
assertThat("com.facebook.hermes:hermes-android:0.43.0")
446460
.isEqualTo(dependencySubstitutions[1].second)
447461
assertThat(
448462
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
@@ -451,11 +465,11 @@ class DependencyUtilsTest {
451465
}
452466

453467
@Test
454-
fun getDependencySubstitutions_withDefaultGroup_substitutesCorrectly_withHermesV1() {
468+
fun getDependencySubstitutions_withDefaultGroupAndFallback_substitutesCorrectly_withClassicHermes() {
455469
val dependencySubstitutions =
456470
getDependencySubstitutions(
457471
DependencyUtils.Coordinates("0.42.0", "0.42.0", "0.43.0"),
458-
hermesV1Enabled = true,
472+
hermesV1Enabled = false,
459473
)
460474

461475
assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first)
@@ -466,7 +480,7 @@ class DependencyUtilsTest {
466480
)
467481
.isEqualTo(dependencySubstitutions[0].third)
468482
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
469-
assertThat("com.facebook.hermes:hermes-android:0.43.0")
483+
assertThat("com.facebook.hermes:hermes-android:0.42.0")
470484
.isEqualTo(dependencySubstitutions[1].second)
471485
assertThat(
472486
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
@@ -475,7 +489,7 @@ class DependencyUtilsTest {
475489
}
476490

477491
@Test
478-
fun getDependencySubstitutions_withCustomGroup_substitutesCorrectly_withClassicHermes() {
492+
fun getDependencySubstitutions_withCustomGroup_substitutesCorrectly_withHermesV1() {
479493
val dependencySubstitutions =
480494
getDependencySubstitutions(
481495
DependencyUtils.Coordinates(
@@ -494,14 +508,14 @@ class DependencyUtilsTest {
494508
)
495509
.isEqualTo(dependencySubstitutions[0].third)
496510
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
497-
assertThat("io.github.test.hermes:hermes-android:0.42.0")
511+
assertThat("io.github.test.hermes:hermes-android:0.43.0")
498512
.isEqualTo(dependencySubstitutions[1].second)
499513
assertThat(
500514
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
501515
)
502516
.isEqualTo(dependencySubstitutions[1].third)
503517
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[2].first)
504-
assertThat("io.github.test.hermes:hermes-android:0.42.0")
518+
assertThat("io.github.test.hermes:hermes-android:0.43.0")
505519
.isEqualTo(dependencySubstitutions[2].second)
506520
assertThat("The hermes-android artifact was moved to com.facebook.hermes publishing group.")
507521
.isEqualTo(dependencySubstitutions[2].third)
@@ -510,14 +524,14 @@ class DependencyUtilsTest {
510524
assertThat("The react-android dependency was modified to use the correct Maven group.")
511525
.isEqualTo(dependencySubstitutions[3].third)
512526
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[4].first)
513-
assertThat("io.github.test.hermes:hermes-android:0.42.0")
527+
assertThat("io.github.test.hermes:hermes-android:0.43.0")
514528
.isEqualTo(dependencySubstitutions[4].second)
515529
assertThat("The hermes-android dependency was modified to use the correct Maven group.")
516530
.isEqualTo(dependencySubstitutions[4].third)
517531
}
518532

519533
@Test
520-
fun getDependencySubstitutions_withCustomGroup_substitutesCorrectly_withHermesV1() {
534+
fun getDependencySubstitutions_withCustomGroupAndFallbackToClassicHermes_substitutesCorrectly_withClassicHermes() {
521535
val dependencySubstitutions =
522536
getDependencySubstitutions(
523537
DependencyUtils.Coordinates(
@@ -527,7 +541,7 @@ class DependencyUtilsTest {
527541
"io.github.test",
528542
"io.github.test.hermes",
529543
),
530-
hermesV1Enabled = true,
544+
hermesV1Enabled = false,
531545
)
532546

533547
assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first)
@@ -537,14 +551,14 @@ class DependencyUtilsTest {
537551
)
538552
.isEqualTo(dependencySubstitutions[0].third)
539553
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
540-
assertThat("io.github.test.hermes:hermes-android:0.43.0")
554+
assertThat("io.github.test.hermes:hermes-android:0.42.0")
541555
.isEqualTo(dependencySubstitutions[1].second)
542556
assertThat(
543557
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
544558
)
545559
.isEqualTo(dependencySubstitutions[1].third)
546560
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[2].first)
547-
assertThat("io.github.test.hermes:hermes-android:0.43.0")
561+
assertThat("io.github.test.hermes:hermes-android:0.42.0")
548562
.isEqualTo(dependencySubstitutions[2].second)
549563
assertThat("The hermes-android artifact was moved to com.facebook.hermes publishing group.")
550564
.isEqualTo(dependencySubstitutions[2].third)
@@ -553,7 +567,7 @@ class DependencyUtilsTest {
553567
assertThat("The react-android dependency was modified to use the correct Maven group.")
554568
.isEqualTo(dependencySubstitutions[3].third)
555569
assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[4].first)
556-
assertThat("io.github.test.hermes:hermes-android:0.43.0")
570+
assertThat("io.github.test.hermes:hermes-android:0.42.0")
557571
.isEqualTo(dependencySubstitutions[4].second)
558572
assertThat("The hermes-android dependency was modified to use the correct Maven group.")
559573
.isEqualTo(dependencySubstitutions[4].third)

packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ class ProjectUtilsTest {
117117
}
118118

119119
@Test
120-
fun isHermesV1Enabled_returnsFalseByDefault() {
121-
assertThat(createProject().isHermesV1Enabled).isFalse()
120+
fun isHermesV1Enabled_returnsTrueByDefault() {
121+
assertThat(createProject().isHermesV1Enabled).isTrue()
122122
}
123123

124124
@Test

0 commit comments

Comments
 (0)