10f6d0ca20
iCloud sync: - Force viewContext.refreshAllObjects() on remote change notifications so data from other devices is picked up immediately without app restart - Call refreshFromCloudKit() on foreground to merge any changes made while the device was inactive - Wait up to 10s for initial CloudKit sync on launch before showing onboarding (shows "Checking iCloud..." during the wait) - New OnboardingICloudCheckView: shown on fresh installs with iCloud available, lets user restore from iCloud before starting onboarding from scratch Localization: - Added de, fr, it, ja, pt-BR lproj folders - New iCloud onboarding strings in en + es-ES (+ button literals) ASO metadata (fastlane): - Updated en-US: new subtitle, keywords, description (fixed "no cloud sync" claim), promotional text, release notes - Added full metadata for es-ES, de-DE, fr-FR, it, ja, pt-BR (63 files total) - All keyword fields validated ≤100 Unicode chars Infrastructure: - Gemfile + Gemfile.lock for fastlane - Scripts/archive_and_upload_appstore.sh for CI/CD Version: 1.2.1 (build 7) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
37 lines
1.5 KiB
Swift
37 lines
1.5 KiB
Swift
import XCTest
|
|
@testable import PortfolioJournal
|
|
|
|
final class CurrencyFormatterTests: XCTestCase {
|
|
|
|
func testParseUserInput_withDotDecimalAndThreeDigits_keepsDecimal() {
|
|
let value = CurrencyFormatter.parseUserInput("533.595", currencySymbol: "€")
|
|
XCTAssertEqual(value, Decimal(string: "533.595"))
|
|
}
|
|
|
|
func testParseUserInput_withCommaDecimalAndThreeDigits_keepsDecimal() {
|
|
let value = CurrencyFormatter.parseUserInput("533,595", currencySymbol: "€")
|
|
XCTAssertEqual(value, Decimal(string: "533.595"))
|
|
}
|
|
|
|
func testParseUserInput_withGroupedThousands_preservesIntegerValue() {
|
|
let dotGrouped = CurrencyFormatter.parseUserInput("1.234.567", currencySymbol: "€")
|
|
let commaGrouped = CurrencyFormatter.parseUserInput("1,234,567", currencySymbol: "$")
|
|
|
|
XCTAssertEqual(dotGrouped, Decimal(string: "1234567"))
|
|
XCTAssertEqual(commaGrouped, Decimal(string: "1234567"))
|
|
}
|
|
|
|
func testParseUserInput_withMixedSeparators_parsesDecimal() {
|
|
let eu = CurrencyFormatter.parseUserInput("1.234,56", currencySymbol: "€")
|
|
let us = CurrencyFormatter.parseUserInput("1,234.56", currencySymbol: "$")
|
|
|
|
XCTAssertEqual(eu, Decimal(string: "1234.56"))
|
|
XCTAssertEqual(us, Decimal(string: "1234.56"))
|
|
}
|
|
|
|
func testParseUserInput_withSmallDecimalValue_keepsPrecision() {
|
|
let value = CurrencyFormatter.parseUserInput("0.000123", currencySymbol: "$")
|
|
XCTAssertEqual(value, Decimal(string: "0.000123"))
|
|
}
|
|
}
|