@@ -240,33 +240,36 @@ void setupReferenceTests() {
240240 group (
241241 'putData' ,
242242 () {
243- test ('uploads a file with buffer and download to check content matches' ,
244- () async {
245- const text = 'put data text to compare with uploaded and downloaded' ;
246- List <int > list = utf8.encode (text);
243+ test (
244+ 'uploads a file with buffer and download to check content matches' ,
245+ () async {
246+ const text =
247+ 'put data text to compare with uploaded and downloaded' ;
248+ List <int > list = utf8.encode (text);
247249
248- Uint8List data = Uint8List .fromList (list);
250+ Uint8List data = Uint8List .fromList (list);
249251
250- final Reference ref =
251- storage.ref ('flutter-tests' ).child ('flt-ok.txt' );
252+ final Reference ref =
253+ storage.ref ('flutter-tests' ).child ('flt-ok.txt' );
252254
253- final TaskSnapshot complete = await ref.putData (
254- data,
255- SettableMetadata (
256- contentLanguage: 'en' ,
257- ),
258- );
255+ final TaskSnapshot complete = await ref.putData (
256+ data,
257+ SettableMetadata (
258+ contentLanguage: 'en' ,
259+ ),
260+ );
259261
260- expect (complete.metadata? .size, text.length);
261- expect (complete.metadata? .contentLanguage, 'en' );
262+ expect (complete.metadata? .size, text.length);
263+ expect (complete.metadata? .contentLanguage, 'en' );
262264
263- // Download the file from Firebase Storage
264- final downloadedData = await ref.getData ();
265- final downloadedContent = String .fromCharCodes (downloadedData! );
265+ // Download the file from Firebase Storage
266+ final downloadedData = await ref.getData ();
267+ final downloadedContent = String .fromCharCodes (downloadedData! );
266268
267- // Verify that the downloaded content matches the original content
268- expect (downloadedContent, equals (text));
269- });
269+ // Verify that the downloaded content matches the original content
270+ expect (downloadedContent, equals (text));
271+ },
272+ );
270273
271274 //TODO(pr-mais): causes the emulator to crash
272275 // test('errors if permission denied', () async {
@@ -282,8 +285,27 @@ void setupReferenceTests() {
282285 // .having((e) => e.message, 'message',
283286 // 'User is not authorized to perform the desired action.')));
284287 // });
288+
289+ test (
290+ 'upload a json file' ,
291+ () async {
292+ final Map <String , dynamic > data = < String , dynamic > {
293+ 'name' : 'John Doe' ,
294+ 'age' : 30 ,
295+ };
296+ final Uint8List jsonData = utf8.encode (jsonEncode (data));
297+ final Reference ref =
298+ storage.ref ('flutter-tests' ).child ('flt-web-ok.json' );
299+ final TaskSnapshot complete = await ref.putData (
300+ jsonData,
301+ SettableMetadata (
302+ contentType: 'application/json' ,
303+ ),
304+ );
305+ expect (complete.metadata? .contentType, 'application/json' );
306+ },
307+ );
285308 },
286- skip: kIsWeb,
287309 );
288310
289311 group ('putBlob' , () {
0 commit comments