@@ -5,8 +5,11 @@ import 'package:appwrite/models.dart' as models;
5
5
import 'package:appwrite/src/enums.dart';
6
6
import 'package:appwrite/src/response.dart';
7
7
import 'dart:typed_data';
8
+ import 'package:appwrite/appwrite.dart';
8
9
9
10
class MockClient extends Mock implements Client {
11
+ Map<String , String > config = {'project': 'testproject'};
12
+
10
13
@override
11
14
Future<Response > call(
12
15
HttpMethod? method, {
@@ -36,7 +39,7 @@ void main() {
36
39
{% if method .type == ' webAuth' %}
37
40
38
41
{%~ elseif method .type == ' location' ~%}
39
- final Uint8List data = [] ;
42
+ final Uint8List data = Uint8List.fromList([]) ;
40
43
{% else %}
41
44
final Map<String , dynamic > data = {
42
45
{# need response model #}
@@ -45,15 +48,20 @@ void main() {
45
48
46
49
when(client.call(
47
50
HttpMethod.{{method .method | caseLower }},
48
- ).then (_) async => Response(data: data));
51
+ )).thenAnswer( (_) async => Response(data: data));
49
52
50
53
final response = await {{service .name | caseCamel }}.{{method .name | caseCamel }}(
51
54
{% for parameter in method .parameters .all %}
52
55
{% if parameter .required %}
53
- ' {{parameter .name | caseCamel }}': '{{parameter .example }}',
56
+ {{parameter .name | caseCamel }}: '{{parameter .example }}',
54
57
{% endif %}
55
58
{% endfor %}
56
59
);
60
+
61
+ {%~ if method .type == ' location' ~%}
62
+ expect(response, isA<Uint8List >());
63
+ {% endif %}
64
+
57
65
});
58
66
59
67
{% endfor %}
0 commit comments