Skip to content

Commit 42d402f

Browse files
authored
[Infra] Fix Combine unit test (#14785)
1 parent 1687f0c commit 42d402f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

FirebaseFunctions/Tests/CombineUnit/HTTPSCallableTests.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,18 @@ class MockFunctions: Functions {
4444
withObject data: Any?,
4545
options: HTTPSCallableOptions?,
4646
timeout: TimeInterval,
47-
completion: @escaping (
48-
(Result<HTTPSCallableResult, any Error>) -> Void
49-
)) {
47+
completion: @escaping @MainActor
48+
(Result<HTTPSCallableResult, any Error>) -> Void) {
5049
do {
5150
try verifyParameters?(url, data, timeout)
5251
let result = try mockCallFunction()
53-
completion(.success(result))
52+
DispatchQueue.main.async {
53+
completion(.success(result))
54+
}
5455
} catch {
55-
completion(.failure(error))
56+
DispatchQueue.main.async {
57+
completion(.failure(error))
58+
}
5659
}
5760
}
5861

0 commit comments

Comments
 (0)