Skip to content

Commit

Permalink
Simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brianquinlan committed Dec 21, 2023
1 parent 5afe399 commit abe76a7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkgs/flutter_http_example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ const _singleBookResponse = '''
"title": "Flutter Cookbook",
"description": "Write, test, and publish your web, desktop...",
"imageLinks": {
"smallThumbnail": "http://books.google.com/books/content?id=gcnAEAAAQBAJ&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api"
"smallThumbnail": "http://thumbnailurl/"
}
}
}
]
}
''';

final image = base64Decode(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
final _dummyPngImage = base64Decode(
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmM'
'IQAAAABJRU5ErkJggg==',
);

void main() {
Expand All @@ -51,9 +52,9 @@ void main() {
if (request.url.path == '/books/v1/volumes' &&
request.url.queryParameters['q'] == 'Flutter') {
return Response(_singleBookResponse, 200);
} else if (request.url.queryParameters['id'] == 'gcnAEAAAQBAJ') {
return Response.bytes(image, 200,
headers: const {'Content-Type': 'image/bmp'});
} else if (request.url == Uri.https('thumbnailurl', '/')) {
return Response.bytes(_dummyPngImage, 200,
headers: const {'Content-Type': 'image/png'});
}
return Response('', 404);
});
Expand Down

0 comments on commit abe76a7

Please sign in to comment.