Skip to content

Commit 28e6676

Browse files
committed
working location type methods tests
1 parent a0155a7 commit 28e6676

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

templates/flutter/test/services/service_test.dart.twig

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import 'package:appwrite/models.dart' as models;
55
import 'package:appwrite/src/enums.dart';
66
import 'package:appwrite/src/response.dart';
77
import 'dart:typed_data';
8+
import 'package:appwrite/appwrite.dart';
89

910
class MockClient extends Mock implements Client {
11+
Map<String, String> config = {'project': 'testproject'};
12+
1013
@override
1114
Future<Response> call(
1215
HttpMethod? method, {
@@ -36,7 +39,7 @@ void main() {
3639
{% if method.type == 'webAuth' %}
3740

3841
{%~ elseif method.type == 'location' ~%}
39-
final Uint8List data = [];
42+
final Uint8List data = Uint8List.fromList([]);
4043
{% else %}
4144
final Map<String, dynamic> data = {
4245
{# need response model #}
@@ -45,15 +48,20 @@ void main() {
4548

4649
when(client.call(
4750
HttpMethod.{{method.method | caseLower}},
48-
).then(_) async => Response(data: data));
51+
)).thenAnswer((_) async => Response(data: data));
4952

5053
final response = await {{service.name | caseCamel}}.{{method.name | caseCamel}}(
5154
{% for parameter in method.parameters.all %}
5255
{% if parameter.required %}
53-
'{{parameter.name | caseCamel}}':'{{parameter.example}}',
56+
{{parameter.name | caseCamel}}: '{{parameter.example}}',
5457
{% endif %}
5558
{% endfor %}
5659
);
60+
61+
{%~ if method.type == 'location' ~%}
62+
expect(response, isA<Uint8List>());
63+
{% endif %}
64+
5765
});
5866

5967
{% endfor %}

0 commit comments

Comments
 (0)