-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Unit tests/basics #28
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :D
- with just some small comments
@@ -3,7 +3,7 @@ package com.tapptitude.core.usecase | |||
import com.tapptitude.core.model.Image | |||
import com.tapptitude.core.repository.ImageRepository | |||
|
|||
class LoadImageUseCase internal constructor(private val imageRepository: ImageRepository) { | |||
class LoadImageUseCase constructor(private val imageRepository: ImageRepository) { | |||
|
|||
suspend fun invoke(): Image = imageRepository.getRandomImage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it also have the operator
modifier? 🤔
@@ -16,7 +16,7 @@ class HomeViewModel( | |||
private val loadImageUseCase: LoadImageUseCase, | |||
private val sessionManager: SessionManager | |||
) : ViewModel() { | |||
private val _isLoading = MutableLiveData<Boolean>() | |||
private val _isLoading = MutableLiveData<Boolean>(false) | |||
val isLoading: LiveData<Boolean> = _isLoading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is supposed to have a getter instead of assigned MutableLiveData value, right?
import kotlinx.coroutines.flow.StateFlow | ||
|
||
internal class FakeSessionManager : SessionManager { | ||
private val _currentLoginStateFlow: MutableStateFlow<LoginState> = MutableStateFlow( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the Hard Wrap
setting value in your Android Studio? I think anything under ~120 is a bit too short
* No need to create an instance of retrofit | ||
*/ | ||
internal class SessionInterceptorTest { | ||
private lateinit var interceptor: SessionInterceptor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer leaving an empty line between class declaration and first field/method. Makes it feel a bit cleaner :D
A a few Unit Test