Loading app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ class AppInstallProcessor @Inject constructor( } private suspend fun validateAgeLimit(appInstall: AppInstall): Boolean { val ageLimitValidationResult = validateAppAgeLimitUseCase.invoke(appInstall) val ageLimitValidationResult = validateAppAgeLimitUseCase(appInstall) if (ageLimitValidationResult.data?.isValid == true) { return true } Loading app/src/main/java/foundation/e/apps/provider/AgeRatingProvider.kt +2 −2 Original line number Diff line number Diff line Loading @@ -223,7 +223,7 @@ class AgeRatingProvider : ContentProvider() { packageName = packageName, source = Source.PLAY_STORE ) val validateResult = validateAppAgeLimitUseCase.invoke(fakeAppInstall) val validateResult = validateAppAgeLimitUseCase(fakeAppInstall) saveContentRatingIfInvalid(validateResult, packageName) return validateResult.data?.isValid Loading @@ -249,7 +249,7 @@ class AgeRatingProvider : ContentProvider() { packageName = packageName, source = Source.OPEN_SOURCE, ) val validateResult = validateAppAgeLimitUseCase.invoke(fakeAppInstall) val validateResult = validateAppAgeLimitUseCase(fakeAppInstall) return validateResult.data?.isValid ?: false } Loading app/src/test/java/foundation/e/apps/installProcessor/AppInstallProcessorTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -190,7 +190,7 @@ class AppInstallProcessorTest { @Test fun `processInstallTest when age limit is satisfied`() = runTest { val fusedDownload = initTest() Mockito.`when`(validateAppAgeRatingUseCase.invoke(fusedDownload)) Mockito.`when`(validateAppAgeRatingUseCase(fusedDownload)) .thenReturn(ResultSupreme.create(ResultStatus.OK, ContentRatingValidity(true))) val finalFusedDownload = runProcessInstall(fusedDownload) Loading @@ -200,7 +200,7 @@ class AppInstallProcessorTest { @Test fun `processInstallTest when age limit is not satisfied`() = runTest { val fusedDownload = initTest() Mockito.`when`(validateAppAgeRatingUseCase.invoke(fusedDownload)) Mockito.`when`(validateAppAgeRatingUseCase(fusedDownload)) .thenReturn(ResultSupreme.create(ResultStatus.OK, ContentRatingValidity(false))) val finalFusedDownload = runProcessInstall(fusedDownload) Loading app/src/test/java/foundation/e/apps/login/LoginViewModelTest.kt +7 −7 Original line number Diff line number Diff line Loading @@ -135,8 +135,8 @@ class LoginViewModelTest { val microgAccount = MicrogAccount(account, "token") val result = MicrogLoginManager.FetchResult.Success(microgAccount) whenever(fetchMicrogAccountUseCase.invoke("user@gmail.com")).thenReturn(result) whenever(initialMicrogLoginUseCase.invoke(microgAccount)).thenReturn(Unit) whenever(fetchMicrogAccountUseCase("user@gmail.com")).thenReturn(result) whenever(initialMicrogLoginUseCase(microgAccount)).thenReturn(Unit) whenever(authenticatorRepository.fetchAuthObjects(any())).thenReturn(emptyList()) var onErrorCalls = 0 Loading @@ -149,7 +149,7 @@ class LoginViewModelTest { onIntentRequired = { onIntentCalls += 1 } ) verify(initialMicrogLoginUseCase).invoke(microgAccount) verify(initialMicrogLoginUseCase)(microgAccount) verify(authenticatorRepository).fetchAuthObjects(any()) assert(onErrorCalls == 0) assert(onIntentCalls == 0) Loading @@ -160,7 +160,7 @@ class LoginViewModelTest { val intent = Intent("test.action") val result = MicrogLoginManager.FetchResult.RequiresUserAction(intent) whenever(fetchMicrogAccountUseCase.invoke("")).thenReturn(result) whenever(fetchMicrogAccountUseCase("")).thenReturn(result) var onIntentCalls = 0 var receivedIntent: Intent? = null Loading @@ -177,13 +177,13 @@ class LoginViewModelTest { assert(onIntentCalls == 1) assert(receivedIntent === intent) verify(initialMicrogLoginUseCase, never()).invoke(any()) verify(initialMicrogLoginUseCase, never())(any()) } @Test fun `initialMicrogLogin reports error when fetch fails`() = runTest { val failure = IllegalStateException("boom") whenever(fetchMicrogAccountUseCase.invoke("")).thenThrow(failure) whenever(fetchMicrogAccountUseCase("")).thenThrow(failure) var errorMessage: String? = null Loading @@ -195,6 +195,6 @@ class LoginViewModelTest { ) assert(errorMessage == "boom") verify(initialMicrogLoginUseCase, never()).invoke(any()) verify(initialMicrogLoginUseCase, never())(any()) } } Loading
app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt +1 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ class AppInstallProcessor @Inject constructor( } private suspend fun validateAgeLimit(appInstall: AppInstall): Boolean { val ageLimitValidationResult = validateAppAgeLimitUseCase.invoke(appInstall) val ageLimitValidationResult = validateAppAgeLimitUseCase(appInstall) if (ageLimitValidationResult.data?.isValid == true) { return true } Loading
app/src/main/java/foundation/e/apps/provider/AgeRatingProvider.kt +2 −2 Original line number Diff line number Diff line Loading @@ -223,7 +223,7 @@ class AgeRatingProvider : ContentProvider() { packageName = packageName, source = Source.PLAY_STORE ) val validateResult = validateAppAgeLimitUseCase.invoke(fakeAppInstall) val validateResult = validateAppAgeLimitUseCase(fakeAppInstall) saveContentRatingIfInvalid(validateResult, packageName) return validateResult.data?.isValid Loading @@ -249,7 +249,7 @@ class AgeRatingProvider : ContentProvider() { packageName = packageName, source = Source.OPEN_SOURCE, ) val validateResult = validateAppAgeLimitUseCase.invoke(fakeAppInstall) val validateResult = validateAppAgeLimitUseCase(fakeAppInstall) return validateResult.data?.isValid ?: false } Loading
app/src/test/java/foundation/e/apps/installProcessor/AppInstallProcessorTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -190,7 +190,7 @@ class AppInstallProcessorTest { @Test fun `processInstallTest when age limit is satisfied`() = runTest { val fusedDownload = initTest() Mockito.`when`(validateAppAgeRatingUseCase.invoke(fusedDownload)) Mockito.`when`(validateAppAgeRatingUseCase(fusedDownload)) .thenReturn(ResultSupreme.create(ResultStatus.OK, ContentRatingValidity(true))) val finalFusedDownload = runProcessInstall(fusedDownload) Loading @@ -200,7 +200,7 @@ class AppInstallProcessorTest { @Test fun `processInstallTest when age limit is not satisfied`() = runTest { val fusedDownload = initTest() Mockito.`when`(validateAppAgeRatingUseCase.invoke(fusedDownload)) Mockito.`when`(validateAppAgeRatingUseCase(fusedDownload)) .thenReturn(ResultSupreme.create(ResultStatus.OK, ContentRatingValidity(false))) val finalFusedDownload = runProcessInstall(fusedDownload) Loading
app/src/test/java/foundation/e/apps/login/LoginViewModelTest.kt +7 −7 Original line number Diff line number Diff line Loading @@ -135,8 +135,8 @@ class LoginViewModelTest { val microgAccount = MicrogAccount(account, "token") val result = MicrogLoginManager.FetchResult.Success(microgAccount) whenever(fetchMicrogAccountUseCase.invoke("user@gmail.com")).thenReturn(result) whenever(initialMicrogLoginUseCase.invoke(microgAccount)).thenReturn(Unit) whenever(fetchMicrogAccountUseCase("user@gmail.com")).thenReturn(result) whenever(initialMicrogLoginUseCase(microgAccount)).thenReturn(Unit) whenever(authenticatorRepository.fetchAuthObjects(any())).thenReturn(emptyList()) var onErrorCalls = 0 Loading @@ -149,7 +149,7 @@ class LoginViewModelTest { onIntentRequired = { onIntentCalls += 1 } ) verify(initialMicrogLoginUseCase).invoke(microgAccount) verify(initialMicrogLoginUseCase)(microgAccount) verify(authenticatorRepository).fetchAuthObjects(any()) assert(onErrorCalls == 0) assert(onIntentCalls == 0) Loading @@ -160,7 +160,7 @@ class LoginViewModelTest { val intent = Intent("test.action") val result = MicrogLoginManager.FetchResult.RequiresUserAction(intent) whenever(fetchMicrogAccountUseCase.invoke("")).thenReturn(result) whenever(fetchMicrogAccountUseCase("")).thenReturn(result) var onIntentCalls = 0 var receivedIntent: Intent? = null Loading @@ -177,13 +177,13 @@ class LoginViewModelTest { assert(onIntentCalls == 1) assert(receivedIntent === intent) verify(initialMicrogLoginUseCase, never()).invoke(any()) verify(initialMicrogLoginUseCase, never())(any()) } @Test fun `initialMicrogLogin reports error when fetch fails`() = runTest { val failure = IllegalStateException("boom") whenever(fetchMicrogAccountUseCase.invoke("")).thenThrow(failure) whenever(fetchMicrogAccountUseCase("")).thenThrow(failure) var errorMessage: String? = null Loading @@ -195,6 +195,6 @@ class LoginViewModelTest { ) assert(errorMessage == "boom") verify(initialMicrogLoginUseCase, never()).invoke(any()) verify(initialMicrogLoginUseCase, never())(any()) } }