Skip to content

Commit

Permalink
More tests for formula-android.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laimiux committed Sep 17, 2024
1 parent f4e4e33 commit 71e10ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.reflect.KClass
*/
class ActivityConfigurator {
internal class Binding<A : FragmentActivity>(
val init: ActivityStoreContext<A>.() -> ActivityStore<A>?
val init: ActivityStoreContext<A>.() -> ActivityStore<A>
)

internal val bindings = mutableMapOf<KClass<*>, Binding<*>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class ActivityStoreFactory internal constructor(
?: return null

val activityDelegate = ActivityStoreContextImpl<A>()
return initializer.init.invoke(activityDelegate)?.let { store ->
return initializer.init.invoke(activityDelegate).let { store ->
ActivityManager(
environment = environment,
delegate = activityDelegate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,14 @@ class ActivityStoreFactoryTest {
val store = factory.init(mock<FakeActivity>())!!
assertThat(store.stateSubscription.isDisposed).isFalse()
}

@Test fun `returns null if no binding for activity is found`() {
val factory = ActivityStoreFactory(
environment = FragmentEnvironment(),
activities = {}
)

val store = factory.init(mock<FakeActivity>())
assertThat(store).isNull()
}
}

0 comments on commit 71e10ec

Please sign in to comment.