179051a8fa
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
846 B
Dart
33 lines
846 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:jiu_client/core/utils/money.dart';
|
|
|
|
void main() {
|
|
group('yuanFromMinor()', () {
|
|
test('299900 分 → "2,999.00"(千分位 + 两位小数)', () {
|
|
expect(yuanFromMinor(299900), '2,999.00');
|
|
});
|
|
|
|
test('100 分 → "1.00"', () {
|
|
expect(yuanFromMinor(100), '1.00');
|
|
});
|
|
|
|
test('0 分 → "0.00"', () {
|
|
expect(yuanFromMinor(0), '0.00');
|
|
});
|
|
|
|
test('个位/十位/百位不加逗号', () {
|
|
expect(yuanFromMinor(5), '0.05');
|
|
expect(yuanFromMinor(99), '0.99');
|
|
expect(yuanFromMinor(12300), '123.00');
|
|
});
|
|
|
|
test('7 位数金额分组正确', () {
|
|
expect(yuanFromMinor(123456789), '1,234,567.89');
|
|
});
|
|
|
|
test('负数保留符号', () {
|
|
expect(yuanFromMinor(-299900), '-2,999.00');
|
|
});
|
|
});
|
|
}
|