diff --git a/app/src/test/java/io/github/sds100/keymapper/mappings/keymaps/ConfigTriggerViewModelTest.kt b/app/src/test/java/io/github/sds100/keymapper/mappings/keymaps/ConfigTriggerViewModelTest.kt index fbac8d08d0..c47c24130d 100644 --- a/app/src/test/java/io/github/sds100/keymapper/mappings/keymaps/ConfigTriggerViewModelTest.kt +++ b/app/src/test/java/io/github/sds100/keymapper/mappings/keymaps/ConfigTriggerViewModelTest.kt @@ -32,6 +32,7 @@ import org.mockito.junit.MockitoJUnitRunner import org.mockito.kotlin.any import org.mockito.kotlin.mock + /** * Created by sds100 on 28/04/2021. */ @@ -82,7 +83,7 @@ class ConfigTriggerViewModelTest { onBlocking { getTriggerErrors(any()) }.thenReturn(emptyList()) }, fakeResourceProvider, - purchasingManager = mock { + purchasingManager = mock(lenient = true) { onBlocking { isPurchased(ProductId.ASSISTANT_TRIGGER) }.thenReturn(Success(false)) onBlocking { getProductPrice(ProductId.ASSISTANT_TRIGGER) }.thenReturn(Success("")) }, @@ -94,21 +95,22 @@ class ConfigTriggerViewModelTest { * issue #602 */ @Test - fun `when create back button trigger key then prompt the user to disable screen pinning`() = runTest(testDispatcher) { - // GIVEN - fakeResourceProvider.stringResourceMap[R.string.dialog_message_screen_pinning_warning] = - "bla" - - // WHEN - onRecordKey.emit( - RecordedKey( - keyCode = KeyEvent.KEYCODE_BACK, - device = TriggerKeyDevice.Internal, - detectionSource = KeyEventDetectionSource.ACCESSIBILITY_SERVICE, - ), - ) + fun `when create back button trigger key then prompt the user to disable screen pinning`() = + runTest(testDispatcher) { + // GIVEN + fakeResourceProvider.stringResourceMap[R.string.dialog_message_screen_pinning_warning] = + "bla" - // THEN - assertThat(viewModel.showPopup.first().ui, `is`(PopupUi.Ok("bla"))) - } + // WHEN + onRecordKey.emit( + RecordedKey( + keyCode = KeyEvent.KEYCODE_BACK, + device = TriggerKeyDevice.Internal, + detectionSource = KeyEventDetectionSource.ACCESSIBILITY_SERVICE, + ), + ) + + // THEN + assertThat(viewModel.showPopup.first().ui, `is`(PopupUi.Ok("bla"))) + } }