forked from mozilla-mobile/android-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue mozilla-mobile#11338: Add a SaveCreditCard dialog to handle sav…
…ing and updating a credit card
- Loading branch information
1 parent
b8d2ff9
commit 68f48bc
Showing
13 changed files
with
817 additions
and
25 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
40 changes: 40 additions & 0 deletions
40
...s/concept/storage/src/test/java/mozilla/components/concept/storage/CreditCardEntryTest.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,40 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package mozilla.components.concept.storage | ||
|
||
import mozilla.components.concept.storage.CreditCard.Companion.ellipsesEnd | ||
import mozilla.components.concept.storage.CreditCard.Companion.ellipsesStart | ||
import mozilla.components.concept.storage.CreditCard.Companion.ellipsis | ||
import mozilla.components.support.ktx.kotlin.last4Digits | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class CreditCardEntryTest { | ||
|
||
private val creditCard = CreditCardEntry( | ||
guid = "1", | ||
name = "Banana Apple", | ||
number = "4111111111111110", | ||
expiryMonth = "5", | ||
expiryYear = "2030", | ||
cardType = "amex" | ||
) | ||
|
||
@Test | ||
fun `WHEN obfuscatedCardNumber getter is called THEN the expected obfuscated card number is returned`() { | ||
assertEquals( | ||
ellipsesStart + | ||
ellipsis + ellipsis + ellipsis + ellipsis + | ||
creditCard.number.last4Digits() + | ||
ellipsesEnd, | ||
creditCard.obfuscatedCardNumber | ||
) | ||
} | ||
|
||
@Test | ||
fun `WHEN expiryDdate getter is called THEN the expected expiry date string is returned`() { | ||
assertEquals("0${creditCard.expiryMonth}/${creditCard.expiryYear}", creditCard.expiryDate) | ||
} | ||
} |
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
Oops, something went wrong.