diff --git a/Sources/Realtime/V2/CallbackManager.swift b/Sources/Realtime/V2/CallbackManager.swift index 557ba6b3..22f67276 100644 --- a/Sources/Realtime/V2/CallbackManager.swift +++ b/Sources/Realtime/V2/CallbackManager.swift @@ -18,6 +18,14 @@ final class CallbackManager: @unchecked Sendable { private let mutableState = LockIsolated(MutableState()) + var serverChanges: [PostgresJoinConfig] { + mutableState.serverChanges + } + + var callbacks: [RealtimeCallback] { + mutableState.callbacks + } + @discardableResult func addBroadcastCallback( event: String, diff --git a/Tests/RealtimeTests/CallbackManagerTests.swift b/Tests/RealtimeTests/CallbackManagerTests.swift index cbd37607..8f399d87 100644 --- a/Tests/RealtimeTests/CallbackManagerTests.swift +++ b/Tests/RealtimeTests/CallbackManagerTests.swift @@ -36,14 +36,14 @@ final class CallbackManagerTests: XCTestCase { XCTAssertEqual(callbackManager.addPresenceCallback { _ in }, 3) - XCTAssertEqual(callbackManager.mutableState.value.callbacks.count, 3) + XCTAssertEqual(callbackManager.callbacks.count, 3) callbackManager.removeCallback(id: 2) callbackManager.removeCallback(id: 3) - XCTAssertEqual(callbackManager.mutableState.value.callbacks.count, 1) + XCTAssertEqual(callbackManager.callbacks.count, 1) XCTAssertFalse( - callbackManager.mutableState.value.callbacks + callbackManager.callbacks .contains(where: { $0.id == 2 || $0.id == 3 }) ) } @@ -62,7 +62,7 @@ final class CallbackManagerTests: XCTestCase { callbackManager.setServerChanges(changes: changes) - XCTAssertEqual(callbackManager.mutableState.value.serverChanges, changes) + XCTAssertEqual(callbackManager.serverChanges, changes) } func testTriggerPostgresChanges() {