Skip to content

Commit

Permalink
chore(storage): improve test coverage for setting metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyokone committed Mar 19, 2024
1 parent 74b9a05 commit 86bb3cf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/integration_test/firebase_storage/reference_e2e.dart
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,25 @@ void setupReferenceTests() {
expect(fullMetadata.customMetadata!['foo'], 'bar');
});

test('delete metadata', () async {
Reference ref = storage.ref('flutter-tests').child('flt-ok.txt');
FullMetadata fullMetadata = await ref
.updateMetadata(SettableMetadata(customMetadata: {'foo': 'bar'}));
expect(fullMetadata.customMetadata!['foo'], 'bar');

fullMetadata = await ref.updateMetadata(
SettableMetadata(
customMetadata: {},
),
);
expect(fullMetadata.customMetadata!['foo'], isNull);

// Setting it again
fullMetadata = await ref
.updateMetadata(SettableMetadata(customMetadata: {'foo': 'bar2'}));
expect(fullMetadata.customMetadata!['foo'], 'bar2');
});

test('errors if property does not exist', () async {
Reference ref = storage.ref('flutter-tests/iDoNotExist.jpeg');

Expand Down

0 comments on commit 86bb3cf

Please sign in to comment.