Skip to content

Instantly share code, notes, and snippets.

@doridori
Last active January 20, 2023 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doridori/4acb19b6ac4e965552ba6961e1bc9054 to your computer and use it in GitHub Desktop.
Save doridori/4acb19b6ac4e965552ba6961e1bc9054 to your computer and use it in GitHub Desktop.
Application as a function blog post code
fun reduce(action: Action, state: State): Effect
@Test
fun `GIVEN user is logged in WHEN app moves to the background THEN user is logged out`() {
Case.given(State(user = LoggedInUser(username = "Dori")))
.andWhen(ApplicationBackgrounded)
.then { newState ->
assertThat(newState.user).isOfType(AnonomousUser)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment