Skip to content

Commit 17fe7ad

Browse files
authored
Empty test file should be empty (#10472)
1 parent d962bd5 commit 17fe7ad

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

FirebaseStorage/Tests/Integration/StorageIntegration.swift

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -416,22 +416,15 @@ class StorageResultTests: StorageIntegrationCommon {
416416

417417
// Download URL format is
418418
// "https://firebasestorage.googleapis.com:443/v0/b/{bucket}/o/{path}?alt=media&token={token}"
419-
let downloadURLPattern =
420-
"^https:\\/\\/firebasestorage.googleapis.com:443\\/v0\\/b\\/[^\\/]*\\/o\\/" +
421-
"ios%2Fpublic%2F1mb\\?alt=media&token=[a-z0-9-]*$"
419+
let downloadURLPrefix =
420+
"https://firebasestorage.googleapis.com:443/v0/b/ios-opensource-samples" +
421+
".appspot.com/o/ios%2Fpublic%2F1mb?alt=media&token"
422422

423423
ref.downloadURL { result in
424424
switch result {
425425
case let .success(downloadURL):
426-
do {
427-
let testRegex = try NSRegularExpression(pattern: downloadURLPattern)
428-
let urlString = downloadURL.absoluteString
429-
XCTAssertEqual(testRegex.numberOfMatches(in: urlString,
430-
range: NSRange(location: 0,
431-
length: urlString.count)), 1)
432-
} catch {
433-
XCTFail("Throw in downloadURL completion block")
434-
}
426+
let urlString = downloadURL.absoluteString
427+
XCTAssertTrue(urlString.hasPrefix(downloadURLPrefix))
435428
case let .failure(error):
436429
XCTFail("Unexpected error \(error) from downloadURL")
437430
}

FirebaseStorage/Tests/Integration/StorageIntegrationCommon.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class StorageIntegrationCommon: XCTestCase {
6767
}
6868
for emptyFile in emptyFiles {
6969
let ref = storage.reference().child(emptyFile)
70-
ref.putData(data) { result in
70+
ref.putData(Data()) { result in
7171
self.assertResultSuccess(result)
7272
setupExpectation.fulfill()
7373
}

0 commit comments

Comments
 (0)