This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 697
Updated FormatMoneyUseCase #3657
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0b8d70d
Updated FormatMoneyUseCase
shamim-emon 6900c68
Empty-Commit
shamim-emon 1db738f
Updated FormatMoneyUseCase - reviews resolved
shamim-emon 9cce740
Updated FormatMoneyUseCase -Empty-Commit
shamim-emon bd9f88a
Updated FormatMoneyUseCase - reviews resolved
shamim-emon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 |
---|---|---|
|
@@ -24,79 +24,154 @@ class FormatMoneyUseCaseTest { | |
val amount: Double, | ||
val showDecimal: Boolean, | ||
val shortenAmount: Boolean, | ||
val isCrypto: Boolean, | ||
val locale: Locale, | ||
val expectedOutput: String | ||
) { | ||
ENG_SHOW_DECIMAL( | ||
amount = 1_000.12, | ||
showDecimal = true, | ||
shortenAmount = false, | ||
isCrypto = false, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "1,000.12" | ||
), | ||
ENG_HIDE_DECIMAL( | ||
amount = 1_000.12, | ||
showDecimal = false, | ||
shortenAmount = false, | ||
isCrypto = false, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "1,000" | ||
), | ||
GERMAN_SHOW_DECIMAL( | ||
amount = 1_000.12, | ||
showDecimal = true, | ||
shortenAmount = false, | ||
isCrypto = false, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "1.000,12" | ||
), | ||
GERMAN_HIDE_DECIMAL( | ||
amount = 1_000.12, | ||
showDecimal = false, | ||
shortenAmount = false, | ||
isCrypto = false, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "1.000" | ||
), | ||
ENGLISH_1K_SHORT_AMT( | ||
amount = 13_000.10, | ||
showDecimal = true, | ||
shortenAmount = true, | ||
isCrypto = false, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "13k" | ||
), | ||
ENGLISH_MILLION_SHORT_AMT( | ||
amount = 1_233_500.10, | ||
showDecimal = true, | ||
shortenAmount = true, | ||
isCrypto = false, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "1.23m" | ||
), | ||
ENGLISH_BILLION_SHORT_AMT( | ||
amount = 1_233_000_000.10, | ||
showDecimal = true, | ||
shortenAmount = true, | ||
isCrypto = false, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "1.23b" | ||
), | ||
GERMAN_1K_SHORT_AMT( | ||
amount = 13_000.10, | ||
showDecimal = true, | ||
shortenAmount = true, | ||
isCrypto = false, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "13k" | ||
), | ||
GERMAN_MILLION_SHORT_AMT( | ||
amount = 1_233_500.10, | ||
showDecimal = true, | ||
shortenAmount = true, | ||
isCrypto = false, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "1,23m" | ||
), | ||
GERMAN_BILLION_SHORT_AMT( | ||
amount = 1_233_000_000.10, | ||
showDecimal = true, | ||
shortenAmount = true, | ||
isCrypto = false, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "1,23b" | ||
), | ||
ENG_SHOW_DECIMAL_CRYPTO( | ||
amount = 123_456.0, | ||
showDecimal = true, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "123,456" | ||
), | ||
ENG_SHOW_DECIMAL_CRYPTO_LONGER_DECIMAL_PLACES( | ||
amount = 0.000_345, | ||
showDecimal = true, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "0.000345" | ||
), | ||
ENG_HIDE_DECIMAL_CRYPTO( | ||
amount = 123_456.0, | ||
showDecimal = false, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "123,456" | ||
), | ||
ENG_HIDE_DECIMAL_CRYPTO_LONGER_DECIMAL_PLACES( | ||
amount = 0.000_345, | ||
showDecimal = false, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.ENGLISH, | ||
expectedOutput = "0.000345" | ||
), | ||
GERMAN_SHOW_DECIMAL_CRYPTO( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a tear case for "0.000345 BTC" for example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
amount = 123_456.0, | ||
showDecimal = true, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "123.456" | ||
), | ||
GERMAN_SHOW_DECIMAL_CRYPTO_LONGER_DECIMAL_PLACES( | ||
amount = 0.000_345, | ||
showDecimal = true, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "0,000345" | ||
), | ||
GERMAN_HIDE_DECIMAL_CRYPTO( | ||
amount = 123_456.0, | ||
showDecimal = false, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "123.456" | ||
), | ||
GERMAN_HIDE_DECIMAL_CRYPTO_LONGER_DECIMAL_PLACES( | ||
amount = 0.000_345, | ||
showDecimal = false, | ||
shortenAmount = false, | ||
isCrypto = true, | ||
locale = Locale.GERMAN, | ||
expectedOutput = "0,000345" | ||
), | ||
} | ||
|
||
private lateinit var formatMoneyUseCase: FormatMoneyUseCase | ||
|
@@ -114,7 +189,8 @@ class FormatMoneyUseCaseTest { | |
// when | ||
val result = formatMoneyUseCase.format( | ||
value = testCase.amount, | ||
shortenAmount = testCase.shortenAmount | ||
shortenAmount = testCase.shortenAmount, | ||
isCrypto = testCase.isCrypto | ||
) | ||
|
||
// then | ||
|
2 changes: 1 addition & 1 deletion
2
temp/legacy-code/src/main/java/com/ivy/legacy/domain/data/IvyCurrency.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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What caused this package change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package directive of
IvyCurrency
data class was wrong. It resides incom.ivy.legacy.domain.data.IvyCurrency
but directive wascom.ivy.wallet.domain.data.IvyCurrency
in the data class file. I fixed it thus these changes appeared as-per correct package directive in places where it's used.