-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
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
24 changes: 24 additions & 0 deletions
24
packages/sdk/android/src/test/java/com/primerioreactnative/utils/ErrorHelperTest.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,24 @@ | ||
package com.primerioreactnative.utils | ||
|
||
import com.primerioreactnative.datamodels.ErrorTypeRN | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class ErrorHelperTest { | ||
|
||
// Create a mock ErrorTypeRN instance | ||
private val errorType = ErrorTypeRN.InvalidVaultedPaymentMethodId | ||
|
||
@Test | ||
fun `errorTo should create PrimerErrorRN with correct properties`() { | ||
// Mock message | ||
val errorMessage = "This is an error message" | ||
|
||
// Call the infix function | ||
val primerError = errorType errorTo errorMessage | ||
|
||
// Verify the errorId and message are set correctly in the PrimerErrorRN object | ||
assertEquals(errorType.errorId, primerError.errorId) | ||
assertEquals(errorMessage, primerError.description) | ||
} | ||
} |