dev
dart 31 lines 753 Bytes
Raw
1 import 'package:cw_core/amount/amount_sanitizer.dart';
2 import 'package:flutter_test/flutter_test.dart';
3
4 void main() {
5 group('smartAmountSanitizer', () {
6 test('sanitize decimal dot', () {
7 final amount = "1,000.00".sanitized();
8 expect(amount, "1000.00");
9 });
10
11 test('sanitize decimal comma', () {
12 final amount = "1.000,00".sanitized();
13 expect(amount, "1000.00");
14 });
15
16 test('general case', () {
17 final amount = "1000.00".sanitized();
18 expect(amount, "1000.00");
19 });
20
21 test('no decimals', () {
22 final amount = "1,000".sanitized();
23 expect(amount, "1.000");
24 });
25
26 test('no decimals', () {
27 final amount = "1.000".sanitized();
28 expect(amount, "1.000");
29 });
30 });
31 }