Skip to content
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

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft

[WIP] Unit tests/basics #28

wants to merge 6 commits into from

Conversation

hdralexandru
Copy link
Collaborator

A a few Unit Test

@hdralexandru hdralexandru marked this pull request as draft January 30, 2023 09:31
Copy link
Collaborator

@catadarjan-tapptitude catadarjan-tapptitude left a 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()
Copy link
Collaborator

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
Copy link
Collaborator

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(
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants