File tree Expand file tree Collapse file tree 3 files changed +49
-9
lines changed
Expand file tree Collapse file tree 3 files changed +49
-9
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ class ClientIO extends ClientBase with ClientMixin {
8080 @override
8181 String get endPoint => _endPoint;
8282
83- Future<Directory > getCookiePath () async {
83+ Future<Directory > _getCookiePath () async {
8484 final directory = await getApplicationDocumentsDirectory();
8585 final path = directory.path;
8686 final Directory dir = Directory('$path/cookies');
@@ -133,7 +133,7 @@ class ClientIO extends ClientBase with ClientMixin {
133133 Future init() async {
134134 if(_initProgress) return;
135135 _initProgress = true;
136- final Directory cookieDir = await getCookiePath ();
136+ final Directory cookieDir = await _getCookiePath ();
137137 _cookieJar = PersistCookieJar(storage: FileStorage(cookieDir.path));
138138 _interceptors.add(CookieManager(_cookieJar));
139139
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ dependencies:
2121 universal_html: ^2.0.8
2222
2323dev_dependencies:
24+ path_provider_platform_interface: ^2.0.5
2425 flutter_lints: ^2.0.1
2526 flutter_test:
2627 sdk: flutter
Original file line number Diff line number Diff line change 11import 'package:flutter/material.dart' ;
2+ import 'package:path_provider_platform_interface/path_provider_platform_interface.dart' ;
3+
24import '../lib/packageName.dart' ;
35import '../lib/client_io.dart' ;
46import '../lib/models.dart' ;
57import 'dart:io' ;
68
7- class MockClient extends ClientIO {
8- Future <Directory > getCookiePath () async {
9- final dir = Directory ('cookies' );
10- await dir.create ();
11- return dir;
9+ class FakePathProvider extends PathProviderPlatform {
10+ @override
11+ Future <String ?> getTemporaryPath () async {
12+ return '.' ;
13+ }
14+
15+ @override
16+ Future <String ?> getApplicationSupportPath () async {
17+ return '.' ;
18+ }
19+
20+ @override
21+ Future <String ?> getLibraryPath () async {
22+ return '.' ;
23+ }
24+
25+ @override
26+ Future <String ?> getApplicationDocumentsPath () async {
27+ return '.' ;
28+ }
29+
30+ @override
31+ Future <String ?> getExternalStoragePath () async {
32+ return '.' ;
33+ }
34+
35+ @override
36+ Future <List <String >?> getExternalCachePaths () async {
37+ return < String > ['.' ];
38+ }
39+
40+ @override
41+ Future <List <String >?> getExternalStoragePaths ({
42+ StorageDirectory ? type,
43+ }) async {
44+ return < String > ['.' ];
45+ }
46+
47+ @override
48+ Future <String ?> getDownloadsPath () async {
49+ return '.' ;
1250 }
1351}
1452
53+
1554void main () async {
1655 WidgetsFlutterBinding .ensureInitialized ();
17-
18- Client client = MockClient ();
56+ PathProviderPlatform .instance = FakePathProvider ();
57+ Client client = Client ();
1958 Foo foo = Foo (client);
2059 Bar bar = Bar (client);
2160 General general = General (client);
You can’t perform that action at this time.
0 commit comments