@@ -154,7 +154,7 @@ void main() {
154154 confirmButtonText: confirmButtonText,
155155 acceptedTypeGroups: acceptedTypeGroups,
156156 suggestedName: suggestedName)
157- ..setPathResponse ( expectedSavePath);
157+ ..setPathsResponse ( < String > [ expectedSavePath] );
158158
159159 final String ? savePath = await getSavePath (
160160 initialDirectory: initialDirectory,
@@ -167,7 +167,7 @@ void main() {
167167 });
168168
169169 test ('works with no arguments' , () async {
170- fakePlatformImplementation.setPathResponse ( expectedSavePath);
170+ fakePlatformImplementation.setPathsResponse ( < String > [ expectedSavePath] );
171171
172172 final String ? savePath = await getSavePath ();
173173 expect (savePath, expectedSavePath);
@@ -176,7 +176,7 @@ void main() {
176176 test ('sets the initial directory' , () async {
177177 fakePlatformImplementation
178178 ..setExpectations (initialDirectory: initialDirectory)
179- ..setPathResponse ( expectedSavePath);
179+ ..setPathsResponse ( < String > [ expectedSavePath] );
180180
181181 final String ? savePath =
182182 await getSavePath (initialDirectory: initialDirectory);
@@ -186,7 +186,7 @@ void main() {
186186 test ('sets the button confirmation label' , () async {
187187 fakePlatformImplementation
188188 ..setExpectations (confirmButtonText: confirmButtonText)
189- ..setPathResponse ( expectedSavePath);
189+ ..setPathsResponse ( < String > [ expectedSavePath] );
190190
191191 final String ? savePath =
192192 await getSavePath (confirmButtonText: confirmButtonText);
@@ -196,7 +196,7 @@ void main() {
196196 test ('sets the accepted type groups' , () async {
197197 fakePlatformImplementation
198198 ..setExpectations (acceptedTypeGroups: acceptedTypeGroups)
199- ..setPathResponse ( expectedSavePath);
199+ ..setPathsResponse ( < String > [ expectedSavePath] );
200200
201201 final String ? savePath =
202202 await getSavePath (acceptedTypeGroups: acceptedTypeGroups);
@@ -206,7 +206,7 @@ void main() {
206206 test ('sets the suggested name' , () async {
207207 fakePlatformImplementation
208208 ..setExpectations (suggestedName: suggestedName)
209- ..setPathResponse ( expectedSavePath);
209+ ..setPathsResponse ( < String > [ expectedSavePath] );
210210
211211 final String ? savePath = await getSavePath (suggestedName: suggestedName);
212212 expect (savePath, expectedSavePath);
@@ -221,7 +221,7 @@ void main() {
221221 ..setExpectations (
222222 initialDirectory: initialDirectory,
223223 confirmButtonText: confirmButtonText)
224- ..setPathResponse ( expectedDirectoryPath);
224+ ..setPathsResponse ( < String > [ expectedDirectoryPath] );
225225
226226 final String ? directoryPath = await getDirectoryPath (
227227 initialDirectory: initialDirectory,
@@ -232,7 +232,8 @@ void main() {
232232 });
233233
234234 test ('works with no arguments' , () async {
235- fakePlatformImplementation.setPathResponse (expectedDirectoryPath);
235+ fakePlatformImplementation
236+ .setPathsResponse (< String > [expectedDirectoryPath]);
236237
237238 final String ? directoryPath = await getDirectoryPath ();
238239 expect (directoryPath, expectedDirectoryPath);
@@ -241,7 +242,7 @@ void main() {
241242 test ('sets the initial directory' , () async {
242243 fakePlatformImplementation
243244 ..setExpectations (initialDirectory: initialDirectory)
244- ..setPathResponse ( expectedDirectoryPath);
245+ ..setPathsResponse ( < String > [ expectedDirectoryPath] );
245246
246247 final String ? directoryPath =
247248 await getDirectoryPath (initialDirectory: initialDirectory);
@@ -251,13 +252,62 @@ void main() {
251252 test ('sets the button confirmation label' , () async {
252253 fakePlatformImplementation
253254 ..setExpectations (confirmButtonText: confirmButtonText)
254- ..setPathResponse ( expectedDirectoryPath);
255+ ..setPathsResponse ( < String > [ expectedDirectoryPath] );
255256
256257 final String ? directoryPath =
257258 await getDirectoryPath (confirmButtonText: confirmButtonText);
258259 expect (directoryPath, expectedDirectoryPath);
259260 });
260261 });
262+
263+ group ('getDirectoryPaths' , () {
264+ const List <String > expectedDirectoryPaths = < String > [
265+ '/example/path' ,
266+ '/example/2/path'
267+ ];
268+
269+ test ('works' , () async {
270+ fakePlatformImplementation
271+ ..setExpectations (
272+ initialDirectory: initialDirectory,
273+ confirmButtonText: confirmButtonText)
274+ ..setPathsResponse (expectedDirectoryPaths);
275+
276+ final List <String ?> directoryPaths = await getDirectoryPaths (
277+ initialDirectory: initialDirectory,
278+ confirmButtonText: confirmButtonText,
279+ );
280+
281+ expect (directoryPaths, expectedDirectoryPaths);
282+ });
283+
284+ test ('works with no arguments' , () async {
285+ fakePlatformImplementation.setPathsResponse (expectedDirectoryPaths);
286+
287+ final List <String ?> directoryPaths = await getDirectoryPaths ();
288+ expect (directoryPaths, expectedDirectoryPaths);
289+ });
290+
291+ test ('sets the initial directory' , () async {
292+ fakePlatformImplementation
293+ ..setExpectations (initialDirectory: initialDirectory)
294+ ..setPathsResponse (expectedDirectoryPaths);
295+
296+ final List <String ?> directoryPaths =
297+ await getDirectoryPaths (initialDirectory: initialDirectory);
298+ expect (directoryPaths, expectedDirectoryPaths);
299+ });
300+
301+ test ('sets the button confirmation label' , () async {
302+ fakePlatformImplementation
303+ ..setExpectations (confirmButtonText: confirmButtonText)
304+ ..setPathsResponse (expectedDirectoryPaths);
305+
306+ final List <String ?> directoryPaths =
307+ await getDirectoryPaths (confirmButtonText: confirmButtonText);
308+ expect (directoryPaths, expectedDirectoryPaths);
309+ });
310+ });
261311}
262312
263313class FakeFileSelector extends Fake
@@ -270,7 +320,7 @@ class FakeFileSelector extends Fake
270320 String ? suggestedName;
271321 // Return values.
272322 List <XFile >? files;
273- String ? path ;
323+ List < String > ? paths ;
274324
275325 void setExpectations ({
276326 List <XTypeGroup > acceptedTypeGroups = const < XTypeGroup > [],
@@ -290,8 +340,8 @@ class FakeFileSelector extends Fake
290340 }
291341
292342 // ignore: use_setters_to_change_properties
293- void setPathResponse ( String path ) {
294- this .path = path ;
343+ void setPathsResponse ( List < String > paths ) {
344+ this .paths = paths ;
295345 }
296346
297347 @override
@@ -329,7 +379,7 @@ class FakeFileSelector extends Fake
329379 expect (initialDirectory, this .initialDirectory);
330380 expect (suggestedName, this .suggestedName);
331381 expect (confirmButtonText, this .confirmButtonText);
332- return path ;
382+ return paths ? [ 0 ] ;
333383 }
334384
335385 @override
@@ -339,6 +389,16 @@ class FakeFileSelector extends Fake
339389 }) async {
340390 expect (initialDirectory, this .initialDirectory);
341391 expect (confirmButtonText, this .confirmButtonText);
342- return path;
392+ return paths? [0 ];
393+ }
394+
395+ @override
396+ Future <List <String >> getDirectoryPaths ({
397+ String ? initialDirectory,
398+ String ? confirmButtonText,
399+ }) async {
400+ expect (initialDirectory, this .initialDirectory);
401+ expect (confirmButtonText, this .confirmButtonText);
402+ return paths! ;
343403 }
344404}
0 commit comments