Used:
- Kotlin
- Hilt
- Jetpack Compose
- Room
- Git flow workflow
App is organized in MVVM architecture. User is able to enter his achievement, which is stored locally with usage of Room database. Kotlin Flows are used to achieve reactive approach and react for database changes. Jetpack Compose is used for building whole UI and supports light/dark theme.
- light/dark theme
- achievements order by date
- Compose bottom sheet layout
- unit tests (also instrumented)
Unit tests and instrumented unit tests are created. Instrumented tests were necessary for testing Room dao, which needs in-memory database. Frameworks used:
Sample test:
@Test
fun `onCloseBottomSheet emits after achievement addition`() = runBlocking {
doReturn(Unit).`when`(repository).insert(any(), any(), any(), any())
viewModel.onCloseBottomSheet.test {
viewModel.onTitleChanged("title")
viewModel.onDescriptionChanged("description")
viewModel.onAddAchievement()
Truth.assertThat(awaitItem()).isNotNull()
}
}