@@ -602,6 +602,7 @@ - (void)assertMetadata:(FIRStorageMetadata *)actualMetadata
602
602
XCTAssertEqualObjects (actualMetadata.contentEncoding , @" gzip" );
603
603
XCTAssertEqualObjects (actualMetadata.contentLanguage , @" de" );
604
604
XCTAssertEqualObjects (actualMetadata.contentType , expectedContentType);
605
+ XCTAssertEqualObjects (actualMetadata.name , @" 1mb" );
605
606
XCTAssertTrue ([actualMetadata.md5Hash length ] == 24 );
606
607
for (NSString *key in expectedCustomMetadata) {
607
608
XCTAssertEqualObjects ([actualMetadata.customMetadata objectForKey: key],
@@ -676,6 +677,45 @@ - (void)testUpdateMetadata {
676
677
[self waitForExpectations ];
677
678
}
678
679
680
+ - (void )testMetadataDictInitAndClear {
681
+ FIRStorageMetadata *metadata = [[FIRStorageMetadata alloc ] initWithDictionary: @{
682
+ @" cacheControl" : @" cache-control" ,
683
+ @" contentDisposition" : @" content-disposition" ,
684
+ @" contentEncoding" : @" gzip" ,
685
+ @" contentLanguage" : @" de" ,
686
+ @" contentType" : @" content-type-a" ,
687
+ @" md5Hash" : @" 123456789012345678901234" , // length 24
688
+ @" name" : @" 1mb" ,
689
+ @" metadata" : @{@" a" : @" b" , @" y" : @" z" }
690
+ }];
691
+
692
+ [self assertMetadata: metadata
693
+ contentType: @" content-type-a"
694
+ customMetadata: @{@" a" : @" b" , @" y" : @" z" }];
695
+
696
+ metadata.cacheControl = nil ;
697
+ metadata.contentDisposition = nil ;
698
+ metadata.contentEncoding = @" identity" ;
699
+ metadata.contentLanguage = nil ;
700
+ metadata.contentType = nil ;
701
+ metadata.customMetadata = nil ;
702
+ [self assertMetadataNil: metadata];
703
+
704
+ metadata.contentEncoding = nil ;
705
+
706
+ XCTestExpectation *expectation =
707
+ [self expectationWithDescription: @" testMetadataDictInitAndClear" ];
708
+ FIRStorageReference *ref = [self .storage referenceWithPath: @" ios/public/1mb" ];
709
+ [ref updateMetadata: metadata
710
+ completion: ^(FIRStorageMetadata *updatedMetadata, NSError *error) {
711
+ XCTAssertNil (error);
712
+ [self assertMetadataNil: updatedMetadata];
713
+ XCTAssertNil (updatedMetadata.customMetadata );
714
+ [expectation fulfill ];
715
+ }];
716
+ [self waitForExpectations ];
717
+ }
718
+
679
719
- (void )testResumeGetFile {
680
720
XCTestExpectation *expectation = [self expectationWithDescription: @" testResumeGetFile" ];
681
721
0 commit comments