Skip to content

Commit

Permalink
Clean up tests for enableLifecycleOwnerWrapper
Browse files Browse the repository at this point in the history
Summary: Clean up tests for enableLifecycleOwnerWrapper

Reviewed By: pentiumao

Differential Revision: D63635108

fbshipit-source-id: a2e6f754f66239584cf29f89ead852f645cbe2f8
  • Loading branch information
jettbow authored and facebook-github-bot committed Oct 3, 2024
1 parent 830f1e4 commit f5dcec1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,7 @@ class ComponentTreeTest {
size,
treePropContainer)
val c = componentTree.mainThreadLayoutState!!.componentContext
if (ComponentsConfiguration.defaultInstance.enableLifecycleOwnerWrapper) {
assertThat(c.treePropContainer?.get(Any::class.java)).isEqualTo("hello world")
} else {
assertThat(c.treePropContainer).isEqualTo(treePropContainer)
}
assertThat(c.treePropContainer?.get(Any::class.java)).isEqualTo("hello world")
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ class UseLiveDataTest {

@Test
fun `should observe lifecycle change when lifecycle owner is set after render`() {
ComponentsConfiguration.defaultInstance =
ComponentsConfiguration.defaultInstance.copy(enableLifecycleOwnerWrapper = true)

// Override new lifecycle owner and provider with local
val rule = ruleWithoutVisibilityEventsController
val fakeLifecycleOwner = FakeLifecycleOwner(Lifecycle.State.INITIALIZED)
Expand Down Expand Up @@ -238,9 +235,6 @@ class UseLiveDataTest {
Assertions.assertThat(liveData.hasObservers()).isFalse
val owner = tree.getTreeProp(LifecycleOwnerTreeProp)
Assertions.assertThat((owner as LifecycleOwnerWrapper).hasObservers()).isFalse

ComponentsConfiguration.defaultInstance =
ComponentsConfiguration.defaultInstance.copy(enableLifecycleOwnerWrapper = false)
}

@Test
Expand Down

0 comments on commit f5dcec1

Please sign in to comment.