Skip to content

Commit 0b1dda4

Browse files
committed
update unit tests
1 parent 9e76455 commit 0b1dda4

File tree

3 files changed

+180
-1
lines changed

3 files changed

+180
-1
lines changed

example/pubspec.lock

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
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+
url: "https://pub.dartlang.org"
9+
source: hosted
10+
version: "31.0.0"
11+
analyzer:
12+
dependency: transitive
13+
description:
14+
name: analyzer
15+
url: "https://pub.dartlang.org"
16+
source: hosted
17+
version: "2.8.0"
18+
args:
19+
dependency: transitive
20+
description:
21+
name: args
22+
url: "https://pub.dartlang.org"
23+
source: hosted
24+
version: "2.3.1"
425
async:
526
dependency: transitive
627
description:
@@ -15,6 +36,27 @@ packages:
1536
url: "https://pub.dartlang.org"
1637
source: hosted
1738
version: "2.1.0"
39+
build:
40+
dependency: transitive
41+
description:
42+
name: build
43+
url: "https://pub.dartlang.org"
44+
source: hosted
45+
version: "2.3.1"
46+
built_collection:
47+
dependency: transitive
48+
description:
49+
name: built_collection
50+
url: "https://pub.dartlang.org"
51+
source: hosted
52+
version: "5.1.1"
53+
built_value:
54+
dependency: transitive
55+
description:
56+
name: built_value
57+
url: "https://pub.dartlang.org"
58+
source: hosted
59+
version: "8.4.3"
1860
characters:
1961
dependency: transitive
2062
description:
@@ -29,20 +71,41 @@ packages:
2971
url: "https://pub.dartlang.org"
3072
source: hosted
3173
version: "1.3.1"
74+
cli_util:
75+
dependency: transitive
76+
description:
77+
name: cli_util
78+
url: "https://pub.dartlang.org"
79+
source: hosted
80+
version: "0.3.5"
3281
clock:
3382
dependency: transitive
3483
description:
3584
name: clock
3685
url: "https://pub.dartlang.org"
3786
source: hosted
3887
version: "1.1.0"
88+
code_builder:
89+
dependency: transitive
90+
description:
91+
name: code_builder
92+
url: "https://pub.dartlang.org"
93+
source: hosted
94+
version: "4.4.0"
3995
collection:
4096
dependency: transitive
4197
description:
4298
name: collection
4399
url: "https://pub.dartlang.org"
44100
source: hosted
45101
version: "1.16.0"
102+
convert:
103+
dependency: transitive
104+
description:
105+
name: convert
106+
url: "https://pub.dartlang.org"
107+
source: hosted
108+
version: "3.1.0"
46109
crypto:
47110
dependency: transitive
48111
description:
@@ -57,13 +120,34 @@ packages:
57120
url: "https://pub.dartlang.org"
58121
source: hosted
59122
version: "0.1.3"
123+
dart_style:
124+
dependency: transitive
125+
description:
126+
name: dart_style
127+
url: "https://pub.dartlang.org"
128+
source: hosted
129+
version: "2.2.1"
60130
fake_async:
61131
dependency: transitive
62132
description:
63133
name: fake_async
64134
url: "https://pub.dartlang.org"
65135
source: hosted
66136
version: "1.3.0"
137+
file:
138+
dependency: transitive
139+
description:
140+
name: file
141+
url: "https://pub.dartlang.org"
142+
source: hosted
143+
version: "6.1.4"
144+
fixnum:
145+
dependency: transitive
146+
description:
147+
name: fixnum
148+
url: "https://pub.dartlang.org"
149+
source: hosted
150+
version: "1.0.1"
67151
flutter:
68152
dependency: "direct main"
69153
description: flutter
@@ -99,7 +183,14 @@ packages:
99183
path: ".."
100184
relative: true
101185
source: path
102-
version: "1.0.6"
186+
version: "1.0.7"
187+
glob:
188+
dependency: transitive
189+
description:
190+
name: glob
191+
url: "https://pub.dartlang.org"
192+
source: hosted
193+
version: "2.1.1"
103194
http:
104195
dependency: transitive
105196
description:
@@ -121,6 +212,13 @@ packages:
121212
url: "https://pub.dartlang.org"
122213
source: hosted
123214
version: "0.6.4"
215+
logging:
216+
dependency: transitive
217+
description:
218+
name: logging
219+
url: "https://pub.dartlang.org"
220+
source: hosted
221+
version: "1.1.0"
124222
matcher:
125223
dependency: transitive
126224
description:
@@ -142,13 +240,27 @@ packages:
142240
url: "https://pub.dartlang.org"
143241
source: hosted
144242
version: "1.7.0"
243+
mockito:
244+
dependency: "direct dev"
245+
description:
246+
name: mockito
247+
url: "https://pub.dartlang.org"
248+
source: hosted
249+
version: "5.0.15"
145250
modal_bottom_sheet:
146251
dependency: transitive
147252
description:
148253
name: modal_bottom_sheet
149254
url: "https://pub.dartlang.org"
150255
source: hosted
151256
version: "2.1.2"
257+
package_config:
258+
dependency: transitive
259+
description:
260+
name: package_config
261+
url: "https://pub.dartlang.org"
262+
source: hosted
263+
version: "2.1.0"
152264
path:
153265
dependency: transitive
154266
description:
@@ -170,11 +282,25 @@ packages:
170282
url: "https://pub.dartlang.org"
171283
source: hosted
172284
version: "2.1.3"
285+
pub_semver:
286+
dependency: transitive
287+
description:
288+
name: pub_semver
289+
url: "https://pub.dartlang.org"
290+
source: hosted
291+
version: "2.1.3"
173292
sky_engine:
174293
dependency: transitive
175294
description: flutter
176295
source: sdk
177296
version: "0.0.99"
297+
source_gen:
298+
dependency: transitive
299+
description:
300+
name: source_gen
301+
url: "https://pub.dartlang.org"
302+
source: hosted
303+
version: "1.2.2"
178304
source_span:
179305
dependency: transitive
180306
description:
@@ -238,6 +364,13 @@ packages:
238364
url: "https://pub.dartlang.org"
239365
source: hosted
240366
version: "2.1.2"
367+
watcher:
368+
dependency: transitive
369+
description:
370+
name: watcher
371+
url: "https://pub.dartlang.org"
372+
source: hosted
373+
version: "1.0.2"
241374
webview_flutter:
242375
dependency: transitive
243376
description:
@@ -266,6 +399,13 @@ packages:
266399
url: "https://pub.dartlang.org"
267400
source: hosted
268401
version: "2.9.5"
402+
yaml:
403+
dependency: transitive
404+
description:
405+
name: yaml
406+
url: "https://pub.dartlang.org"
407+
source: hosted
408+
version: "3.1.1"
269409
sdks:
270410
dart: ">=2.17.0 <3.0.0"
271411
flutter: ">=3.0.0"

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies:
1717
dev_dependencies:
1818
flutter_test:
1919
sdk: flutter
20+
mockito: 5.0.15
2021
flutter:
2122

2223
uses-material-design: true

test/core/customer_test.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import 'package:flutter_test/flutter_test.dart';
2+
import 'package:flutterwave_standard/flutterwave.dart';
3+
4+
main() {
5+
group("Customer object", () {
6+
test("should initialize correctly when values are set", () {
7+
final email = "testEmail";
8+
final phoneNumber = "123456789";
9+
final name = "Random Name";
10+
final customer = Customer(email: email, name: name, phoneNumber: phoneNumber);
11+
12+
expect(email, customer.email);
13+
expect(phoneNumber, customer.phoneNumber);
14+
expect(name, customer.name);
15+
16+
final customerHashmap = {
17+
"email": email,
18+
"phonenumber": phoneNumber,
19+
"name": name
20+
};
21+
expect(customerHashmap.toString(), customer.toJson().toString());
22+
23+
});
24+
25+
test("should initialize correctly when required value is set", () {
26+
final email = "testEmail";
27+
final customer = Customer(email: email);
28+
29+
expect(email, customer.email);
30+
expect(true, customer.phoneNumber == null);
31+
expect(true, customer.name == null);
32+
33+
final customerHashmap = { "email": email };
34+
expect(customerHashmap.toString(), customer.toJson().toString());
35+
});
36+
37+
});
38+
}

0 commit comments

Comments
 (0)