aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example/Storage/Tests
diff options
context:
space:
mode:
authorGravatar Sebastian Schmidt <mrschmidt@google.com>2018-04-13 12:17:36 -0700
committerGravatar Sebastian Schmidt <mrschmidt@google.com>2018-04-13 12:20:32 -0700
commite86665b1ba2bbaf7ddd70873118badc812e0bc20 (patch)
tree1e23f791a5a49e0fabcae2c5dc052db08d5f184e /Example/Storage/Tests
parenta7ce4d9d3c33ac5e1e1ce9a5e7952cb0946aba96 (diff)
Addressing feedback
Diffstat (limited to 'Example/Storage/Tests')
-rw-r--r--Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m15
-rw-r--r--Example/Storage/Tests/Unit/FIRStorageMetadataTests.m1
2 files changed, 14 insertions, 2 deletions
diff --git a/Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m b/Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m
index 5b428c1..b20108a 100644
--- a/Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m
+++ b/Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m
@@ -392,10 +392,21 @@ NSTimeInterval kFIRStorageIntegrationTestTimeout = 30;
FIRStorageReference *ref = [self.storage referenceWithPath:@"ios/public/1mb"];
+ // Download URL format is
+ // "https://firebasestorage.googleapis.com/v0/b/{bucket}/o/{path}?alt=media&token={token}"
+ NSString *downloadURLPattern =
+ @"^https:\\/\\/firebasestorage.googleapis.com\\/v0\\/b\\/[^\\/]*\\/o\\/"
+ @"ios%2Fpublic%2F1mb\\?alt=media&token=[a-z0-9-]*$";
+
[ref downloadURLWithCompletion:^(NSURL *downloadURL, NSError *error) {
XCTAssertNil(error);
- XCTAssertTrue(
- [[downloadURL absoluteString] hasPrefix:@"https://firebasestorage.googleapis.com/"]);
+ NSRegularExpression *testRegex =
+ [NSRegularExpression regularExpressionWithPattern:downloadURLPattern options:0 error:nil];
+ NSString *urlString = [downloadURL absoluteString];
+ XCTAssertEqual([testRegex numberOfMatchesInString:urlString
+ options:0
+ range:NSMakeRange(0, [urlString length])],
+ 1);
[expectation fulfill];
}];
diff --git a/Example/Storage/Tests/Unit/FIRStorageMetadataTests.m b/Example/Storage/Tests/Unit/FIRStorageMetadataTests.m
index 6c8bfa5..6a83741 100644
--- a/Example/Storage/Tests/Unit/FIRStorageMetadataTests.m
+++ b/Example/Storage/Tests/Unit/FIRStorageMetadataTests.m
@@ -16,6 +16,7 @@
#import <XCTest/XCTest.h>
#import "FIRStorageGetDownloadURLTask.h"
+#import "FIRStorageGetDownloadURLTask_Private.h"
#import "FIRStorageMetadata.h"
#import "FIRStorageMetadata_Private.h"
#import "FIRStorageUtils.h"