Skip to content

Commit 7578731

Browse files
committed
Implement a unit test for updating the remote configuration
1 parent ef1b4eb commit 7578731

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

FirebaseRemoteConfig/Tests/Swift/SwiftAPI/APITests.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,31 @@ class APITests: APITestBase {
179179
registration.remove()
180180
}
181181

182+
func testRealtimeRemoteConfigRealConsoleAsync() async {
183+
guard APITests.useFakeConfig == false else { return }
184+
185+
let expectation = expectation(description: #function)
186+
187+
let task = Task {
188+
for await updateResult in config.updateStream {
189+
switch updateResult {
190+
case let .success(update):
191+
XCTAssertNotNil(update)
192+
XCTAssertNotNil(update.updatedKeys.contains(Constants.jedi))
193+
case let .failure(error):
194+
XCTFail("Expected a successful update result, but received an error: \(error)")
195+
}
196+
197+
expectation.fulfill()
198+
}
199+
}
200+
201+
console.updateRemoteConfigValue(Constants.yoda, forKey: Constants.jedi)
202+
203+
await fulfillment(of: [expectation], timeout: 5.0)
204+
task.cancel()
205+
}
206+
182207
// MARK: - RemoteConfigConsole Tests
183208

184209
func testFetchConfigThenUpdateConsoleThenFetchAgain() {

0 commit comments

Comments
 (0)