mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-01 02:02:33 +01:00
NumberFormat.currency(name:) prints 'EUR 2,08' — the per-month figure now takes its symbol from the store's own formatted price (falling back to simpleCurrency), extracted as testable paywallFormatPrice. The selection radio was 28px on cards that are 17px-titled; it's 20px now. The Base card's title drops from w800 to w500 so it reads as the quiet option. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
26 lines
1014 B
Dart
26 lines
1014 B
Dart
// The paywall used NumberFormat.currency(name:), which prints the ISO code
|
|
// ("EUR 2,08") instead of the symbol riders expect.
|
|
import 'package:bike_control/pages/paywall.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('uses the symbol from the store price, not the ISO code', () {
|
|
final euro = paywallFormatPrice(2.0825, 'EUR', sampleFormattedPrice: '24,99 €');
|
|
expect(euro, contains('€'));
|
|
expect(euro, isNot(contains('EUR')));
|
|
|
|
final dollar = paywallFormatPrice(2.4158, 'USD', sampleFormattedPrice: r'$28.99');
|
|
expect(dollar, contains(r'$'));
|
|
expect(dollar, isNot(contains('USD')));
|
|
});
|
|
|
|
test('falls back to a symbol when the store gave us no sample', () {
|
|
final euro = paywallFormatPrice(2.08, 'EUR');
|
|
expect(euro, isNot(contains('EUR')), reason: 'simpleCurrency resolves EUR to €');
|
|
});
|
|
|
|
test('rounds to two decimals', () {
|
|
expect(paywallFormatPrice(2.0825, 'EUR', sampleFormattedPrice: '24,99 €'), contains('2.08'));
|
|
});
|
|
}
|