@@ -43,49 +43,46 @@ void main() {
43
43
await plugin
44
44
.openFile (acceptedTypeGroups: < XTypeGroup > [group, groupTwo]);
45
45
46
- expect (
46
+ expectMethodCall (
47
47
log,
48
- < Matcher > [
49
- isMethodCall ('openFile' , arguments: < String , dynamic > {
50
- 'acceptedTypeGroups' : < Map <String , dynamic >> [
51
- group.toJSON (),
52
- groupTwo.toJSON ()
53
- ],
54
- 'initialDirectory' : null ,
55
- 'confirmButtonText' : null ,
56
- 'multiple' : false ,
57
- }),
58
- ],
48
+ 'openFile' ,
49
+ arguments: < String , dynamic > {
50
+ 'acceptedTypeGroups' : < Map <String , dynamic >> [
51
+ group.toJSON (),
52
+ groupTwo.toJSON ()
53
+ ],
54
+ 'initialDirectory' : null ,
55
+ 'confirmButtonText' : null ,
56
+ 'multiple' : false ,
57
+ },
59
58
);
60
59
});
61
60
test ('passes initialDirectory correctly' , () async {
62
61
await plugin.openFile (initialDirectory: '/example/directory' );
63
62
64
- expect (
63
+ expectMethodCall (
65
64
log,
66
- < Matcher > [
67
- isMethodCall ('openFile' , arguments: < String , dynamic > {
68
- 'acceptedTypeGroups' : null ,
69
- 'initialDirectory' : '/example/directory' ,
70
- 'confirmButtonText' : null ,
71
- 'multiple' : false ,
72
- }),
73
- ],
65
+ 'openFile' ,
66
+ arguments: < String , dynamic > {
67
+ 'acceptedTypeGroups' : null ,
68
+ 'initialDirectory' : '/example/directory' ,
69
+ 'confirmButtonText' : null ,
70
+ 'multiple' : false ,
71
+ },
74
72
);
75
73
});
76
74
test ('passes confirmButtonText correctly' , () async {
77
75
await plugin.openFile (confirmButtonText: 'Open File' );
78
76
79
- expect (
77
+ expectMethodCall (
80
78
log,
81
- < Matcher > [
82
- isMethodCall ('openFile' , arguments: < String , dynamic > {
83
- 'acceptedTypeGroups' : null ,
84
- 'initialDirectory' : null ,
85
- 'confirmButtonText' : 'Open File' ,
86
- 'multiple' : false ,
87
- }),
88
- ],
79
+ 'openFile' ,
80
+ arguments: < String , dynamic > {
81
+ 'acceptedTypeGroups' : null ,
82
+ 'initialDirectory' : null ,
83
+ 'confirmButtonText' : 'Open File' ,
84
+ 'multiple' : false ,
85
+ },
89
86
);
90
87
});
91
88
});
@@ -108,49 +105,46 @@ void main() {
108
105
await plugin
109
106
.openFiles (acceptedTypeGroups: < XTypeGroup > [group, groupTwo]);
110
107
111
- expect (
108
+ expectMethodCall (
112
109
log,
113
- < Matcher > [
114
- isMethodCall ('openFile' , arguments: < String , dynamic > {
115
- 'acceptedTypeGroups' : < Map <String , dynamic >> [
116
- group.toJSON (),
117
- groupTwo.toJSON ()
118
- ],
119
- 'initialDirectory' : null ,
120
- 'confirmButtonText' : null ,
121
- 'multiple' : true ,
122
- }),
123
- ],
110
+ 'openFile' ,
111
+ arguments: < String , dynamic > {
112
+ 'acceptedTypeGroups' : < Map <String , dynamic >> [
113
+ group.toJSON (),
114
+ groupTwo.toJSON ()
115
+ ],
116
+ 'initialDirectory' : null ,
117
+ 'confirmButtonText' : null ,
118
+ 'multiple' : true ,
119
+ },
124
120
);
125
121
});
126
122
test ('passes initialDirectory correctly' , () async {
127
123
await plugin.openFiles (initialDirectory: '/example/directory' );
128
124
129
- expect (
125
+ expectMethodCall (
130
126
log,
131
- < Matcher > [
132
- isMethodCall ('openFile' , arguments: < String , dynamic > {
133
- 'acceptedTypeGroups' : null ,
134
- 'initialDirectory' : '/example/directory' ,
135
- 'confirmButtonText' : null ,
136
- 'multiple' : true ,
137
- }),
138
- ],
127
+ 'openFile' ,
128
+ arguments: < String , dynamic > {
129
+ 'acceptedTypeGroups' : null ,
130
+ 'initialDirectory' : '/example/directory' ,
131
+ 'confirmButtonText' : null ,
132
+ 'multiple' : true ,
133
+ },
139
134
);
140
135
});
141
136
test ('passes confirmButtonText correctly' , () async {
142
137
await plugin.openFiles (confirmButtonText: 'Open File' );
143
138
144
- expect (
139
+ expectMethodCall (
145
140
log,
146
- < Matcher > [
147
- isMethodCall ('openFile' , arguments: < String , dynamic > {
148
- 'acceptedTypeGroups' : null ,
149
- 'initialDirectory' : null ,
150
- 'confirmButtonText' : 'Open File' ,
151
- 'multiple' : true ,
152
- }),
153
- ],
141
+ 'openFile' ,
142
+ arguments: < String , dynamic > {
143
+ 'acceptedTypeGroups' : null ,
144
+ 'initialDirectory' : null ,
145
+ 'confirmButtonText' : 'Open File' ,
146
+ 'multiple' : true ,
147
+ },
154
148
);
155
149
});
156
150
});
@@ -174,108 +168,109 @@ void main() {
174
168
await plugin
175
169
.getSavePath (acceptedTypeGroups: < XTypeGroup > [group, groupTwo]);
176
170
177
- expect (
171
+ expectMethodCall (
178
172
log,
179
- < Matcher > [
180
- isMethodCall ('getSavePath' , arguments: < String , dynamic > {
181
- 'acceptedTypeGroups' : < Map <String , dynamic >> [
182
- group.toJSON (),
183
- groupTwo.toJSON ()
184
- ],
185
- 'initialDirectory' : null ,
186
- 'suggestedName' : null ,
187
- 'confirmButtonText' : null ,
188
- }),
189
- ],
173
+ 'getSavePath' ,
174
+ arguments: < String , dynamic > {
175
+ 'acceptedTypeGroups' : < Map <String , dynamic >> [
176
+ group.toJSON (),
177
+ groupTwo.toJSON ()
178
+ ],
179
+ 'initialDirectory' : null ,
180
+ 'suggestedName' : null ,
181
+ 'confirmButtonText' : null ,
182
+ },
190
183
);
191
184
});
192
185
test ('passes initialDirectory correctly' , () async {
193
186
await plugin.getSavePath (initialDirectory: '/example/directory' );
194
187
195
- expect (
188
+ expectMethodCall (
196
189
log,
197
- < Matcher > [
198
- isMethodCall ('getSavePath' , arguments: < String , dynamic > {
199
- 'acceptedTypeGroups' : null ,
200
- 'initialDirectory' : '/example/directory' ,
201
- 'suggestedName' : null ,
202
- 'confirmButtonText' : null ,
203
- }),
204
- ],
190
+ 'getSavePath' ,
191
+ arguments: < String , dynamic > {
192
+ 'acceptedTypeGroups' : null ,
193
+ 'initialDirectory' : '/example/directory' ,
194
+ 'suggestedName' : null ,
195
+ 'confirmButtonText' : null ,
196
+ },
205
197
);
206
198
});
207
199
test ('passes confirmButtonText correctly' , () async {
208
200
await plugin.getSavePath (confirmButtonText: 'Open File' );
209
201
210
- expect (
202
+ expectMethodCall (
211
203
log,
212
- < Matcher > [
213
- isMethodCall ('getSavePath' , arguments: < String , dynamic > {
214
- 'acceptedTypeGroups' : null ,
215
- 'initialDirectory' : null ,
216
- 'suggestedName' : null ,
217
- 'confirmButtonText' : 'Open File' ,
218
- }),
219
- ],
204
+ 'getSavePath' ,
205
+ arguments: < String , dynamic > {
206
+ 'acceptedTypeGroups' : null ,
207
+ 'initialDirectory' : null ,
208
+ 'suggestedName' : null ,
209
+ 'confirmButtonText' : 'Open File' ,
210
+ },
220
211
);
221
212
});
222
213
});
223
214
group ('#getDirectoryPath' , () {
224
215
test ('passes initialDirectory correctly' , () async {
225
216
await plugin.getDirectoryPath (initialDirectory: '/example/directory' );
226
217
227
- expect (
218
+ expectMethodCall (
228
219
log,
229
- < Matcher > [
230
- isMethodCall ('getDirectoryPath' , arguments: < String , dynamic > {
231
- 'initialDirectory' : '/example/directory' ,
232
- 'confirmButtonText' : null ,
233
- }),
234
- ],
220
+ 'getDirectoryPath' ,
221
+ arguments: < String , dynamic > {
222
+ 'initialDirectory' : '/example/directory' ,
223
+ 'confirmButtonText' : null ,
224
+ },
235
225
);
236
226
});
237
227
test ('passes confirmButtonText correctly' , () async {
238
228
await plugin.getDirectoryPath (confirmButtonText: 'Select Folder' );
239
229
240
- expect (
230
+ expectMethodCall (
241
231
log,
242
- < Matcher > [
243
- isMethodCall ('getDirectoryPath' , arguments: < String , dynamic > {
244
- 'initialDirectory' : null ,
245
- 'confirmButtonText' : 'Select Folder' ,
246
- }),
247
- ],
232
+ 'getDirectoryPath' ,
233
+ arguments: < String , dynamic > {
234
+ 'initialDirectory' : null ,
235
+ 'confirmButtonText' : 'Select Folder' ,
236
+ },
248
237
);
249
238
});
250
239
});
251
240
group ('#getDirectoryPaths' , () {
252
241
test ('passes initialDirectory correctly' , () async {
253
242
await plugin.getDirectoryPaths (initialDirectory: '/example/directory' );
254
243
255
- expect (
244
+ expectMethodCall (
256
245
log,
257
- < Matcher > [
258
- isMethodCall ('getDirectoryPaths' , arguments: < String , dynamic > {
259
- 'initialDirectory' : '/example/directory' ,
260
- 'confirmButtonText' : null ,
261
- }),
262
- ],
246
+ 'getDirectoryPaths' ,
247
+ arguments: < String , dynamic > {
248
+ 'initialDirectory' : '/example/directory' ,
249
+ 'confirmButtonText' : null ,
250
+ },
263
251
);
264
252
});
265
253
test ('passes confirmButtonText correctly' , () async {
266
254
await plugin.getDirectoryPaths (
267
255
confirmButtonText: 'Select one or more Folders' );
268
256
269
- expect (
257
+ expectMethodCall (
270
258
log,
271
- < Matcher > [
272
- isMethodCall ('getDirectoryPaths' , arguments: < String , dynamic > {
273
- 'initialDirectory' : null ,
274
- 'confirmButtonText' : 'Select one or more Folders' ,
275
- }),
276
- ],
259
+ 'getDirectoryPaths' ,
260
+ arguments: < String , dynamic > {
261
+ 'initialDirectory' : null ,
262
+ 'confirmButtonText' : 'Select one or more Folders' ,
263
+ },
277
264
);
278
265
});
279
266
});
280
267
});
281
268
}
269
+
270
+ void expectMethodCall (
271
+ List <MethodCall > log,
272
+ String methodName, {
273
+ Map <String , dynamic >? arguments,
274
+ }) {
275
+ expect (log, < Matcher > [isMethodCall (methodName, arguments: arguments)]);
276
+ }
0 commit comments