Bläddra i källkod

Restore StorageErrorDomain and error tests (#9628)

Paul Beusterien 4 år sedan
förälder
incheckning
86919fb705

+ 2 - 2
FirebaseFunctions/Sources/FunctionsError.swift

@@ -14,10 +14,10 @@
 
 import Foundation
 
-// The error domain for codes in the FIRFunctionsErrorCode enum.
+/// The error domain for codes in the `FunctionsErrorCode` enum.
 public let FunctionsErrorDomain: String = "com.firebase.functions"
 
-// The key for finding error details in the NSError userInfo.
+/// The key for finding error details in the `NSError` userInfo.
 public let FunctionsErrorDetailsKey: String = "details"
 
 /**

+ 7 - 1
FirebaseFunctions/Tests/Unit/FunctionsAPITests.swift

@@ -15,11 +15,12 @@
 // MARK: This file is used to evaluate the experience of using Firebase APIs in Swift.
 
 import Foundation
+import XCTest
 
 import FirebaseCore
 import FirebaseFunctions
 
-final class FunctionsAPITests {
+final class FunctionsAPITests: XCTestCase {
   func usage() {
     // MARK: - Functions
 
@@ -139,4 +140,9 @@ final class FunctionsAPITests {
       }
     }
   }
+
+  func testErrorGlobals() {
+    XCTAssertEqual(FunctionsErrorDetailsKey, "details")
+    XCTAssertEqual(FunctionsErrorDomain, "com.firebase.functions")
+  }
 }

+ 3 - 0
FirebaseStorage/Sources/StorageError.swift

@@ -15,6 +15,9 @@
 import Foundation
 import FirebaseStorageInternal
 
+// The error domain for codes in the StorageErrorCode enum.
+public let StorageErrorDomain: String = "FIRStorageErrorDomain"
+
 public enum StorageError: Error {
   case unknown
   case objectNotFound(String)

+ 6 - 5
FirebaseStorage/Tests/Unit/StorageAPITests.swift

@@ -15,11 +15,12 @@
 // MARK: This file is used to evaluate the experience of using Firebase APIs in Swift.
 
 import Foundation
+import XCTest
 
 import FirebaseCore
 import FirebaseStorage
 
-final class StorageAPITests {
+final class StorageAPITests: XCTestCase {
   func StorageAPIs() {
     let app = FirebaseApp.app()
     _ = Storage.storage()
@@ -115,12 +116,12 @@ final class StorageAPITests {
       var _: StorageVoidSnapshot
       var _: StorageVoidURLError
     }
-
-    func StorageConstantsGlobal() -> String {
-      return StorageErrorDomain
-    }
   #endif
 
+  func testStorageConstantsGlobal() {
+    XCTAssertEqual(StorageErrorDomain, "FIRStorageErrorDomain")
+  }
+
   func StorageListResultApis(result: StorageListResult) {
     _ = result.prefixes
     _ = result.items