cleanup and unit tests
This commit is contained in:
@@ -51,6 +51,28 @@ void main() {
|
||||
var dto = await controller.get(id: 4);
|
||||
expect(dto, isA<CustomerDto>());
|
||||
});
|
||||
|
||||
test('export a customer', () async {
|
||||
final client = MockClient();
|
||||
DiContainer.instance.put(HttpClientUtils, TestHttpCLientUtilsImpl(client));
|
||||
|
||||
when(client.get(Uri.parse('http://localhost:8080/api/customer/export/4'), headers: {"Accept-Language": "en-US"}))
|
||||
.thenAnswer((_) async => http.Response(_customerJson, 200));
|
||||
|
||||
var dto = await controller.export(customerId: 4);
|
||||
expect(dto, isA<List<int>>());
|
||||
});
|
||||
|
||||
test('export a customer picture', () async {
|
||||
final client = MockClient();
|
||||
DiContainer.instance.put(HttpClientUtils, TestHttpCLientUtilsImpl(client));
|
||||
|
||||
when(client.get(Uri.parse('http://localhost:8080/api/customer/export/4?picture=1'), headers: {"Accept-Language": "en-US"}))
|
||||
.thenAnswer((_) async => http.Response(_customerJson, 200));
|
||||
|
||||
var dto = await controller.export(customerId: 4, pictureId: 1);
|
||||
expect(dto, isA<List<int>>());
|
||||
});
|
||||
}
|
||||
|
||||
String _customersJson = '''[
|
||||
|
||||
Reference in New Issue
Block a user