Skip to content

Commit

Permalink
Address review and resulting test implications
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Jul 31, 2024
1 parent 597c476 commit da5e338
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions FirebaseStorage/Tests/Unit/StorageComponentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ class StorageComponentTests: StorageTestHelpers {

/// Tests that a Storage instance can be created properly.
func testStorageInstanceCreation() throws {
let app = try XCTUnwrap(StorageComponentTests.app)
let app = try XCTUnwrap(app)
let storage1 = Storage.storage(app: app, url: "gs://foo-bar.appspot.com")
XCTAssertNotNil(storage1)
}

/// Tests that a Storage instances are reused properly.
func testMultipleComponentInstancesCreated() throws {
let app = try XCTUnwrap(StorageComponentTests.app)
let app = try XCTUnwrap(app)
let storage1 = Storage.storage(app: app, url: "gs://foo-bar.appspot.com")
let storage2 = Storage.storage(app: app, url: "gs://foo-bar.appspot.com")

Expand Down
13 changes: 8 additions & 5 deletions FirebaseStorage/Tests/Unit/StorageTestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@ import XCTest

@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
class StorageTestHelpers: XCTestCase {
static var app: FirebaseApp!
var app: FirebaseApp!

static var uniqueApp = 0
func storage() -> Storage {
return Storage(app: FirebaseApp.app()!, bucket: "bucket")
return Storage(app: app, bucket: "bucket")
}

override class func setUp() {
override func setUp() {
super.setUp()
if app == nil {
let options = FirebaseOptions(googleAppID: "0:0000000000000:ios:0000000000000000",
gcmSenderID: "00000000000000000-00000000000-000000000")
options.projectID = "myProjectID"
FirebaseApp.configure(options: options)
app = FirebaseApp(instanceWithName: "test", options: options)
StorageTestHelpers.uniqueApp += 1
let appName = "test\(StorageTestHelpers.uniqueApp)"
FirebaseApp.configure(name: appName, options: options)
app = FirebaseApp.app(name: appName)
}
}

Expand Down

0 comments on commit da5e338

Please sign in to comment.