mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
BIT-2022: Autofill crash (#1126)
This commit is contained in:
committed by
Álison Fernandes
parent
3e680b9703
commit
b3e4d3807c
+9
-5
@@ -7,6 +7,7 @@ import com.x8bit.bitwarden.data.autofill.model.AutofillAppInfo
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertNull
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class FillRequestExtensionsTest {
|
||||
@@ -22,7 +23,9 @@ class FillRequestExtensionsTest {
|
||||
@Test
|
||||
fun `getInlinePresentationSpecs should return empty list when request is null`() {
|
||||
// Setup
|
||||
val autofillAppInfo: AutofillAppInfo = mockk()
|
||||
val autofillAppInfo: AutofillAppInfo = mockk {
|
||||
every { sdkInt } returns 30
|
||||
}
|
||||
val expected: List<InlinePresentationSpec> = emptyList()
|
||||
|
||||
// Test
|
||||
@@ -38,7 +41,9 @@ class FillRequestExtensionsTest {
|
||||
@Test
|
||||
fun `getInlinePresentationSpecs should return empty list when disabled`() {
|
||||
// Setup
|
||||
val autofillAppInfo: AutofillAppInfo = mockk()
|
||||
val autofillAppInfo: AutofillAppInfo = mockk {
|
||||
every { sdkInt } returns 30
|
||||
}
|
||||
val expected: List<InlinePresentationSpec> = emptyList()
|
||||
|
||||
// Test
|
||||
@@ -52,14 +57,13 @@ class FillRequestExtensionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getInlinePresentationSpecs should return empty list when enabled pre-R`() {
|
||||
fun `getInlinePresentationSpecs should return null when enabled pre-R`() {
|
||||
// Setup
|
||||
val autofillAppInfo = AutofillAppInfo(
|
||||
context = mockk(),
|
||||
packageName = "com.x8bit.bitwarden",
|
||||
sdkInt = 17,
|
||||
)
|
||||
val expected: List<InlinePresentationSpec> = emptyList()
|
||||
|
||||
// Test
|
||||
val actual = fillRequest.getInlinePresentationSpecs(
|
||||
@@ -68,7 +72,7 @@ class FillRequestExtensionsTest {
|
||||
)
|
||||
|
||||
// Verify
|
||||
assertEquals(expected, actual)
|
||||
assertNull(actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user