-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AND-17944: Move GetContactVerificationWarningUseCase to domain module
- Loading branch information
Showing
16 changed files
with
86 additions
and
67 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...main/java/mega/privacy/android/app/domain/usecase/GetContactVerificationWarningUseCase.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
.../java/mega/privacy/android/app/domain/usecase/GetContactVerificationWarningUseCaseTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...otlin/mega/privacy/android/domain/usecase/contact/GetContactVerificationWarningUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package mega.privacy.android.domain.usecase.contact | ||
|
||
import mega.privacy.android.domain.repository.NodeRepository | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Use case for getting contact verification warning flag | ||
*/ | ||
class GetContactVerificationWarningUseCase @Inject constructor( | ||
private val nodeRepository: NodeRepository, | ||
) { | ||
/** | ||
* Invoke | ||
*/ | ||
suspend operator fun invoke() = nodeRepository.getContactVerificationEnabledWarning() | ||
} |
42 changes: 42 additions & 0 deletions
42
...n/mega/privacy/android/domain/usecase/contact/GetContactVerificationWarningUseCaseTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package mega.privacy.android.domain.usecase.contact | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import kotlinx.coroutines.test.runTest | ||
import mega.privacy.android.domain.repository.NodeRepository | ||
import org.junit.jupiter.api.BeforeAll | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.TestInstance | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.ValueSource | ||
import org.mockito.kotlin.mock | ||
import org.mockito.kotlin.reset | ||
import org.mockito.kotlin.whenever | ||
|
||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
class GetContactVerificationWarningUseCaseTest { | ||
|
||
private val nodeRepository: NodeRepository = mock() | ||
private lateinit var underTest: GetContactVerificationWarningUseCase | ||
|
||
@BeforeAll | ||
fun setUp() { | ||
underTest = GetContactVerificationWarningUseCase(nodeRepository = nodeRepository) | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(booleans = [false, true]) | ||
fun `test that the use case returns the correct warning state`(warningEnabled: Boolean) = | ||
runTest { | ||
whenever(nodeRepository.getContactVerificationEnabledWarning()).thenReturn( | ||
warningEnabled | ||
) | ||
val value = underTest() | ||
assertThat(value).isEqualTo(warningEnabled) | ||
} | ||
|
||
@BeforeEach | ||
fun resetMocks() { | ||
reset(nodeRepository) | ||
} | ||
|
||
} |