Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vjrj
ginkgo
Commits
e844e480
Commit
e844e480
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Remove warnings with moch in tests
parent
1aeda977
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ui/widgets/first_screen/g1_textfield.dart
+2
-1
2 additions, 1 deletion
lib/ui/widgets/first_screen/g1_textfield.dart
test/ui_test.dart
+31
-9
31 additions, 9 deletions
test/ui_test.dart
with
33 additions
and
10 deletions
lib/ui/widgets/first_screen/g1_textfield.dart
+
2
−
1
View file @
e844e480
...
...
@@ -148,6 +148,7 @@ class _G1PayAmountFieldState extends State<G1PayAmountField> {
TextPosition
(
offset:
_controller
.
text
.
length
));
value
=
_controller
.
text
;
}
return
validateDecimal
(
sep:
sep
,
locale:
locale
,
amount:
value
);
return
validateDecimal
(
sep:
sep
,
locale:
locale
,
amount:
value
,
tr:
(
String
s
)
=
>
tr
(
s
));
}
}
This diff is collapsed.
Click to expand it.
test/ui_test.dart
+
31
−
9
View file @
e844e480
...
...
@@ -10,6 +10,15 @@ void main() {
expect
(
parsedDouble
,
equals
(
1234.56
));
});
test
(
'localizedParseToDouble parses a localized double zero ended string correctly'
,
()
{
const
String
doubleString
=
'1.234,50'
;
final
double
parsedDouble
=
parseToDoubleLocalized
(
locale:
'es'
,
number:
doubleString
);
expect
(
parsedDouble
,
equals
(
1234.5
));
});
test
(
'valid and invalid comments'
,
()
{
const
List
<
String
>
invalidText
=
<
String
>[
'á'
,
'`e'
,
'ç'
,
'ñ'
,
','
];
const
List
<
String
>
validText
=
<
String
>[
...
...
@@ -29,59 +38,72 @@ void main() {
reason:
'Failed
$text
'
);
}
});
String
tr
(
String
s
)
=
>
s
;
test
(
'Valid decimal number - en_US'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
'.'
,
locale:
'en_US'
,
amount:
'123.45'
);
validateDecimal
(
sep:
'.'
,
locale:
'en_US'
,
amount:
'123.45'
,
tr:
tr
);
expect
(
result
,
null
);
});
test
(
'Valid decimal number - es_ES'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
'123,45'
);
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
'123,45'
,
tr:
tr
);
expect
(
result
,
null
);
});
test
(
'Empty amount - en_US'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
'.'
,
locale:
'en_US'
,
amount:
''
);
validateDecimal
(
sep:
'.'
,
locale:
'en_US'
,
amount:
''
,
tr:
tr
);
expect
(
result
,
null
);
});
test
(
'Amount starts with separator - es_ES'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
',45'
,
tr:
tr
);
expect
(
result
,
null
);
});
test
(
'Amount starts with separator - es_ES'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
',45'
);
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
',45'
,
tr:
tr
);
expect
(
result
,
null
);
});
test
(
'Amount decimal ends with zero - es_ES'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
'2,40'
,
tr:
tr
);
expect
(
result
,
null
);
});
test
(
'Negative number - en_US'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
'.'
,
locale:
'en_US'
,
amount:
'-123.45'
);
validateDecimal
(
sep:
'.'
,
locale:
'en_US'
,
amount:
'-123.45'
,
tr:
tr
);
expect
(
result
,
'enter_a_positive_number'
);
});
test
(
'Invalid number - es_ES'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
'12a,45'
);
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
'12a,45'
,
tr:
tr
);
expect
(
result
,
'enter_a_valid_number'
);
});
test
(
'Invalid number - es_ES'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
'0.45'
);
validateDecimal
(
sep:
','
,
locale:
'es_ES'
,
amount:
'0.45'
,
tr:
tr
);
expect
(
result
,
'enter_a_valid_number'
);
});
test
(
'Invalid number - en'
,
()
{
final
String
?
result
=
validateDecimal
(
sep:
'.'
,
locale:
'en'
,
amount:
'0,45'
);
validateDecimal
(
sep:
'.'
,
locale:
'en'
,
amount:
'0,45'
,
tr:
tr
);
expect
(
result
,
'enter_a_valid_number'
);
});
group
(
'humanizeContact'
,
()
{
test
(
'Should return "your_wallet" if pubKey matches publicAddress'
,
()
{
const
String
publicAddress
=
'your_public_address'
;
const
Contact
contact
=
Contact
(
pubKey:
'your_public_address'
);
final
String
result
=
humanizeContact
(
publicAddress
,
contact
);
final
String
result
=
humanizeContact
(
publicAddress
,
contact
,
false
,
tr
);
expect
(
result
,
'your_wallet'
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment