Skip to content

Commit e81f1e8

Browse files
committed
Unittest
1 parent d0ad1c6 commit e81f1e8

File tree

14 files changed

+519
-18
lines changed

14 files changed

+519
-18
lines changed

.githooks/pre-commit

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
exec flutter analyze
1+
flutter analyze
2+
flutter test

lib/screens/new_project/participant_tile.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import '../../models/participant.dart';
55
import '../../models/project.dart';
66
import '../../utils/helper/confirm_box.dart';
77

8+
// TODO: make immutable
9+
// ignore: must_be_immutable
810
class ParticipantTile extends StatefulWidget {
911
ParticipantTile({
1012
super.key,

lib/screens/project/expenses/new_entry.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import '../../../models/item.dart';
1010
import '../../../models/participant.dart';
1111
import '../../../models/project.dart';
1212
import '../../../widgets/new_screen.dart';
13-
import '../../../utils/ext/text_input_formatter.dart';
13+
import '../../../utils/helper/text_input_formatter.dart';
1414
import '../../../utils/ext/time.dart';
1515
import 'entry_table.dart';
1616

lib/utils/ext/string.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
extension StringExtension on String {
22
String capitalize() {
3+
if (length == 0) return '';
34
return '${this[0].toUpperCase()}${substring(1).toLowerCase()}';
45
}
56

67
String firstCapitalize() {
8+
if (length == 0) return '';
79
return '${this[0].toUpperCase()}${substring(1)}';
810
}
911
}

lib/utils/ext/time.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ extension DateExtension on DateTime {
6666

6767
int daysTo(DateTime to) {
6868
DateTime from = DateTime(year, month, day);
69-
to = DateTime(from.year, from.month, from.day);
69+
to = DateTime(to.year, to.month, to.day);
7070
return (to.difference(from).inHours / 24).round();
7171
}
7272

lib/utils/ext/text_input_formatter.dart renamed to lib/utils/helper/text_input_formatter.dart

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import 'dart:math';
23

34
import 'package:flutter/services.dart';
@@ -15,20 +16,6 @@ class DecimalTextInputFormatter extends TextInputFormatter {
1516
TextSelection newSelection = newValue.selection;
1617
String truncated = newValue.text;
1718

18-
// try {
19-
// return TextEditingValue(
20-
// text: double.parse(newValue.text).toStringAsPrecision(2),
21-
// selection: newSelection,
22-
// composing: TextRange.empty,
23-
// );
24-
// } catch (e) {
25-
// return TextEditingValue(
26-
// text: oldValue.text,
27-
// selection: oldValue.selection,
28-
// composing: oldValue.composing,
29-
// );
30-
// }
31-
3219
if (truncated == '.') {
3320
truncated = '0.';
3421
newSelection = newValue.selection.copyWith(

pubspec.lock

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4+
_fe_analyzer_shared:
5+
dependency: transitive
6+
description:
7+
name: _fe_analyzer_shared
8+
sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
9+
url: "https://pub.dev"
10+
source: hosted
11+
version: "61.0.0"
12+
analyzer:
13+
dependency: transitive
14+
description:
15+
name: analyzer
16+
sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
17+
url: "https://pub.dev"
18+
source: hosted
19+
version: "5.13.0"
420
app_links:
521
dependency: "direct main"
622
description:
@@ -89,6 +105,14 @@ packages:
89105
url: "https://pub.dev"
90106
source: hosted
91107
version: "3.1.1"
108+
coverage:
109+
dependency: transitive
110+
description:
111+
name: coverage
112+
sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097"
113+
url: "https://pub.dev"
114+
source: hosted
115+
version: "1.6.3"
92116
cross_file:
93117
dependency: transitive
94118
description:
@@ -200,6 +224,22 @@ packages:
200224
description: flutter
201225
source: sdk
202226
version: "0.0.0"
227+
frontend_server_client:
228+
dependency: transitive
229+
description:
230+
name: frontend_server_client
231+
sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
232+
url: "https://pub.dev"
233+
source: hosted
234+
version: "3.2.0"
235+
glob:
236+
dependency: transitive
237+
description:
238+
name: glob
239+
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
240+
url: "https://pub.dev"
241+
source: hosted
242+
version: "2.1.2"
203243
http:
204244
dependency: transitive
205245
description:
@@ -208,6 +248,14 @@ packages:
208248
url: "https://pub.dev"
209249
source: hosted
210250
version: "0.13.5"
251+
http_multi_server:
252+
dependency: transitive
253+
description:
254+
name: http_multi_server
255+
sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b"
256+
url: "https://pub.dev"
257+
source: hosted
258+
version: "3.2.1"
211259
http_parser:
212260
dependency: transitive
213261
description:
@@ -232,6 +280,14 @@ packages:
232280
url: "https://pub.dev"
233281
source: hosted
234282
version: "0.18.0"
283+
io:
284+
dependency: transitive
285+
description:
286+
name: io
287+
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
288+
url: "https://pub.dev"
289+
source: hosted
290+
version: "1.0.4"
235291
js:
236292
dependency: transitive
237293
description:
@@ -256,6 +312,14 @@ packages:
256312
url: "https://pub.dev"
257313
source: hosted
258314
version: "2.0.1"
315+
logging:
316+
dependency: transitive
317+
description:
318+
name: logging
319+
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
320+
url: "https://pub.dev"
321+
source: hosted
322+
version: "1.2.0"
259323
matcher:
260324
dependency: transitive
261325
description:
@@ -288,6 +352,30 @@ packages:
288352
url: "https://pub.dev"
289353
source: hosted
290354
version: "1.0.4"
355+
mocktail:
356+
dependency: "direct dev"
357+
description:
358+
name: mocktail
359+
sha256: "80a996cd9a69284b3dc521ce185ffe9150cde69767c2d3a0720147d93c0cef53"
360+
url: "https://pub.dev"
361+
source: hosted
362+
version: "0.3.0"
363+
node_preamble:
364+
dependency: transitive
365+
description:
366+
name: node_preamble
367+
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
368+
url: "https://pub.dev"
369+
source: hosted
370+
version: "2.0.2"
371+
package_config:
372+
dependency: transitive
373+
description:
374+
name: package_config
375+
sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
376+
url: "https://pub.dev"
377+
source: hosted
378+
version: "2.1.0"
291379
path:
292380
dependency: "direct main"
293381
description:
@@ -384,6 +472,14 @@ packages:
384472
url: "https://pub.dev"
385473
source: hosted
386474
version: "3.7.3"
475+
pool:
476+
dependency: transitive
477+
description:
478+
name: pool
479+
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
480+
url: "https://pub.dev"
481+
source: hosted
482+
version: "1.5.1"
387483
process:
388484
dependency: transitive
389485
description:
@@ -392,6 +488,14 @@ packages:
392488
url: "https://pub.dev"
393489
source: hosted
394490
version: "4.2.4"
491+
pub_semver:
492+
dependency: transitive
493+
description:
494+
name: pub_semver
495+
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
496+
url: "https://pub.dev"
497+
source: hosted
498+
version: "2.1.4"
395499
select_form_field:
396500
dependency: "direct main"
397501
description:
@@ -472,11 +576,59 @@ packages:
472576
url: "https://pub.dev"
473577
source: hosted
474578
version: "2.1.5"
579+
shelf:
580+
dependency: transitive
581+
description:
582+
name: shelf
583+
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
584+
url: "https://pub.dev"
585+
source: hosted
586+
version: "1.4.1"
587+
shelf_packages_handler:
588+
dependency: transitive
589+
description:
590+
name: shelf_packages_handler
591+
sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
592+
url: "https://pub.dev"
593+
source: hosted
594+
version: "3.0.2"
595+
shelf_static:
596+
dependency: transitive
597+
description:
598+
name: shelf_static
599+
sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e
600+
url: "https://pub.dev"
601+
source: hosted
602+
version: "1.1.2"
603+
shelf_web_socket:
604+
dependency: transitive
605+
description:
606+
name: shelf_web_socket
607+
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
608+
url: "https://pub.dev"
609+
source: hosted
610+
version: "1.0.4"
475611
sky_engine:
476612
dependency: transitive
477613
description: flutter
478614
source: sdk
479615
version: "0.0.99"
616+
source_map_stack_trace:
617+
dependency: transitive
618+
description:
619+
name: source_map_stack_trace
620+
sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae"
621+
url: "https://pub.dev"
622+
source: hosted
623+
version: "2.1.1"
624+
source_maps:
625+
dependency: transitive
626+
description:
627+
name: source_maps
628+
sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
629+
url: "https://pub.dev"
630+
source: hosted
631+
version: "0.10.12"
480632
source_span:
481633
dependency: transitive
482634
description:
@@ -541,6 +693,14 @@ packages:
541693
url: "https://pub.dev"
542694
source: hosted
543695
version: "1.2.1"
696+
test:
697+
dependency: transitive
698+
description:
699+
name: test
700+
sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d
701+
url: "https://pub.dev"
702+
source: hosted
703+
version: "1.22.0"
544704
test_api:
545705
dependency: transitive
546706
description:
@@ -549,6 +709,14 @@ packages:
549709
url: "https://pub.dev"
550710
source: hosted
551711
version: "0.4.16"
712+
test_core:
713+
dependency: transitive
714+
description:
715+
name: test_core
716+
sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888"
717+
url: "https://pub.dev"
718+
source: hosted
719+
version: "0.4.20"
552720
tuple:
553721
dependency: "direct main"
554722
description:
@@ -613,6 +781,38 @@ packages:
613781
url: "https://pub.dev"
614782
source: hosted
615783
version: "2.1.4"
784+
vm_service:
785+
dependency: transitive
786+
description:
787+
name: vm_service
788+
sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7
789+
url: "https://pub.dev"
790+
source: hosted
791+
version: "9.4.0"
792+
watcher:
793+
dependency: transitive
794+
description:
795+
name: watcher
796+
sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0"
797+
url: "https://pub.dev"
798+
source: hosted
799+
version: "1.0.2"
800+
web_socket_channel:
801+
dependency: transitive
802+
description:
803+
name: web_socket_channel
804+
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
805+
url: "https://pub.dev"
806+
source: hosted
807+
version: "2.4.0"
808+
webkit_inspection_protocol:
809+
dependency: transitive
810+
description:
811+
name: webkit_inspection_protocol
812+
sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d"
813+
url: "https://pub.dev"
814+
source: hosted
815+
version: "1.2.0"
616816
win32:
617817
dependency: transitive
618818
description:

pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: splitr is a free and open-source app that lets you create multiple
33

44
publish_to: 'none'
55

6-
version: 0.4.1
6+
version: 0.4.2
77

88
environment:
99
sdk: '>=2.18.6 <3.0.0'
@@ -33,6 +33,7 @@ dev_dependencies:
3333

3434
flutter_launcher_icons: ^0.13.1
3535
flutter_lints: ^2.0.0
36+
mocktail: ^0.3.0
3637

3738
flutter:
3839
uses-material-design: true

0 commit comments

Comments
 (0)