Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class ProjectConfigFaceBioSdkMigration @Inject constructor() : DataMigration<Pro
Simber.i("Migration of project configuration face bio sdk is done", tag = MIGRATION)
}

override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) = with(currentData.face) {
!hasRankOne() || allowedSdksCount == 0
override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) = with(currentData) {
hasFace() && (!face.hasRankOne() || face.allowedSdksCount == 0)
}

override suspend fun migrate(currentData: ProtoProjectConfiguration): ProtoProjectConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ProjectConfigFaceEmptyVersionMigration @Inject constructor() : DataMigrati
Simber.i("Migration of project configuration face bio sdk empty version is done", tag = MIGRATION)
}

override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) = with(currentData.face) {
rankOne.version.isEmpty()
override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) = with(currentData) {
hasFace() && face.rankOne.version.isEmpty()
}

override suspend fun migrate(currentData: ProtoProjectConfiguration): ProtoProjectConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class ProjectConfigFingerprintBioSdkMigration @Inject constructor() : DataMigrat
Simber.i("Migration of project configuration fingerprint bio sdk is done", tag = MIGRATION)
}

override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) = with(currentData.fingerprint) {
!(hasNec() || hasSecugenSimMatcher())
override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) = with(currentData) {
hasFingerprint() && !(fingerprint.hasNec() || fingerprint.hasSecugenSimMatcher())
}

override suspend fun migrate(currentData: ProtoProjectConfiguration): ProtoProjectConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class ProjectConfigLedsModeMigration @Inject constructor() : DataMigration<Proto
Simber.i("Migration of project configuration displayLiveFeedback to leds mode is done", tag = MIGRATION)
}

override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) =
currentData.fingerprint.secugenSimMatcher.vero2.displayLiveFeedback
override suspend fun shouldMigrate(currentData: ProtoProjectConfiguration) = with(currentData) {
hasFingerprint() && fingerprint.secugenSimMatcher.vero2.displayLiveFeedback
}

override suspend fun migrate(currentData: ProtoProjectConfiguration): ProtoProjectConfiguration {
Simber.i("Start migration of project configuration displayLiveFeedback to leds mode ", tag = MIGRATION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test

class ProjectConfigFaceBioSdkMigrationTest {
@Test
fun `should not migrate if doesn't have face`() = runTest {
val currentData = ProtoProjectConfiguration
.newBuilder()
.build()
val shouldMigrate = ProjectConfigFaceBioSdkMigration().shouldMigrate(currentData)

assertThat(shouldMigrate).isFalse()
}

@Test
fun `should migrate if face has no rankone config`() = runTest {
val currentData = ProtoProjectConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test

class ProjectConfigFaceEmptyVersionMigrationTest {
@Test
fun `should not migrate if doesn't have face`() = runTest {
val currentData = ProtoProjectConfiguration
.newBuilder()
.build()

val shouldMigrate = ProjectConfigFaceEmptyVersionMigration().shouldMigrate(currentData)

assertThat(shouldMigrate).isFalse()
}

@Test
fun `should migrate if face has empty version`() = runTest {
val currentData = ProtoProjectConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ class ProjectConfigFingerprintBioSdkMigrationTest {
Truth.assertThat(shouldMigrate).isTrue()
}

@Test
fun `should not migrate if doesn't have fingerprint`() = runTest {
val currentData = ProtoProjectConfiguration
.newBuilder()
.build()

val shouldMigrate = ProjectConfigFingerprintBioSdkMigration().shouldMigrate(currentData)

Truth.assertThat(shouldMigrate).isFalse()
}

@Test
fun `should not migrate if fingerprint has nec`() = runTest {
val currentData = ProtoProjectConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,23 @@ class ProjectConfigLedsModeMigrationTest {
every { mockSecugenSimMatcher.vero2 } returns mockVero2
}

@Test
fun `test doesn't have fingerprint, then shouldMigrate should return false`() = runBlocking {
// Given
every { mockProtoConfig.fingerprint } returns null

// When
val result = migration.shouldMigrate(mockProtoConfig)

// Then
assertThat(result).isFalse()
}

@Test
fun `test displayLiveFeedback is enabled, then shouldMigrate should return true`() = runBlocking {
// Given
every { mockProtoConfig.hasFingerprint() } returns true
every { mockProtoConfig.fingerprint } returns mockFingerprint
val mockVero2 = mockk<ProtoVero2Configuration>(relaxed = true)
every { mockProtoConfig.fingerprint.secugenSimMatcher.vero2 } returns mockVero2
every { mockVero2.displayLiveFeedback } returns true
Expand All @@ -51,6 +65,8 @@ class ProjectConfigLedsModeMigrationTest {
@Test
fun `test displayLiveFeedback is disabled, then shouldMigrate should return false`() = runBlocking {
// Given
every { mockProtoConfig.hasFingerprint() } returns true
every { mockProtoConfig.fingerprint } returns mockFingerprint
val mockVero2 = mockk<ProtoVero2Configuration>(relaxed = true)
every { mockProtoConfig.fingerprint.secugenSimMatcher.vero2 } returns mockVero2
every { mockVero2.displayLiveFeedback } returns false
Expand Down