Skip to content

Commit 86bb3cf

Browse files
committed
chore(storage): improve test coverage for setting metadata
1 parent 74b9a05 commit 86bb3cf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/integration_test/firebase_storage/reference_e2e.dart

+19
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,25 @@ void setupReferenceTests() {
391391
expect(fullMetadata.customMetadata!['foo'], 'bar');
392392
});
393393

394+
test('delete metadata', () async {
395+
Reference ref = storage.ref('flutter-tests').child('flt-ok.txt');
396+
FullMetadata fullMetadata = await ref
397+
.updateMetadata(SettableMetadata(customMetadata: {'foo': 'bar'}));
398+
expect(fullMetadata.customMetadata!['foo'], 'bar');
399+
400+
fullMetadata = await ref.updateMetadata(
401+
SettableMetadata(
402+
customMetadata: {},
403+
),
404+
);
405+
expect(fullMetadata.customMetadata!['foo'], isNull);
406+
407+
// Setting it again
408+
fullMetadata = await ref
409+
.updateMetadata(SettableMetadata(customMetadata: {'foo': 'bar2'}));
410+
expect(fullMetadata.customMetadata!['foo'], 'bar2');
411+
});
412+
394413
test('errors if property does not exist', () async {
395414
Reference ref = storage.ref('flutter-tests/iDoNotExist.jpeg');
396415

0 commit comments

Comments
 (0)