mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-11 22:55:59 +05:45
* FIS: Throw exception on incomplete Firebase config. * API docs updated. * FirebaseInstallations bump minor version: 1.1.0 * Fix tests * Text fixed * Make exception message more informative * Fix Remote Config tests. * Tests updated to use GCMSenderID if projectID is not available. * Use `GCMSenderID` when `projectID` is not available. * ./scripts/style.sh * Comments * GCMSenderID and projectID validation updated. * Comment * FirebaseInstallations: version bump to 1.0.1. * FIS changelog * FirebaseInstallations: version bump to 1.1.0 * FIS and Core changelogs. * Changelogs remove GCMSenderID * Typo * Typo * fix link * Revert Core changelog * FIS changelog fix.
53 lines
1.8 KiB
Swift
53 lines
1.8 KiB
Swift
/*
|
|
* Copyright 2019 Google
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import FirebaseCore
|
|
import FirebaseMessaging
|
|
import XCTest
|
|
|
|
class FIRMessagingInstanceTest: XCTestCase {
|
|
|
|
func testSingleton_worksAfterDelete() {
|
|
// This is an example of a functional test case.
|
|
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
let options = FirebaseOptions(googleAppID: "1:123:ios:123abc", gcmSenderID: "valid-sender-id")
|
|
options.apiKey = "api-key"
|
|
options.projectID = "project-id"
|
|
FirebaseApp.configure(options: options)
|
|
let original = Messaging.messaging()
|
|
|
|
// Get and delete the default app.
|
|
guard let defaultApp = FirebaseApp.app() else {
|
|
XCTFail("Default app was not configured properly.")
|
|
return
|
|
}
|
|
|
|
// The delete API is synchronous, so the default app will be deleted afterwards.
|
|
defaultApp.delete { (success) in
|
|
XCTAssertTrue(success, "FirebaseApp deletion should be successful")
|
|
}
|
|
|
|
XCTAssertNil(FirebaseApp.app(), "The default app should be `nil` at this point.")
|
|
|
|
// Re-configure the app to trigger Messaging to re-instantiate.
|
|
FirebaseApp.configure(options: options)
|
|
|
|
// Get another instance of Messaging, make sure it's not the same instance.
|
|
let postDelete = Messaging.messaging()
|
|
XCTAssertNotEqual(original, postDelete)
|
|
}
|
|
}
|