diff --git a/Sources/AblyChat/RoomLifecycleManager.swift b/Sources/AblyChat/RoomLifecycleManager.swift index fa856a87..4ea178f2 100644 --- a/Sources/AblyChat/RoomLifecycleManager.swift +++ b/Sources/AblyChat/RoomLifecycleManager.swift @@ -31,7 +31,7 @@ internal actor RoomLifecycleManager { internal init(contributors: [Contributor], logger: InternalLogger, clock: SimpleClock) { self.init( - current: .initialized, + current: nil, contributors: contributors, logger: logger, clock: clock @@ -39,7 +39,7 @@ internal actor RoomLifecycleManager { } #if DEBUG - internal init(testsOnly_current current: RoomLifecycle, contributors: [Contributor], logger: InternalLogger, clock: SimpleClock) { + internal init(testsOnly_current current: RoomLifecycle? = nil, contributors: [Contributor], logger: InternalLogger, clock: SimpleClock) { self.init( current: current, contributors: contributors, @@ -49,8 +49,8 @@ internal actor RoomLifecycleManager { } #endif - private init(current: RoomLifecycle, contributors: [Contributor], logger: InternalLogger, clock: SimpleClock) { - self.current = current + private init(current: RoomLifecycle?, contributors: [Contributor], logger: InternalLogger, clock: SimpleClock) { + self.current = current ?? .initialized self.contributors = contributors self.logger = logger self.clock = clock diff --git a/Tests/AblyChatTests/RoomLifecycleManagerTests.swift b/Tests/AblyChatTests/RoomLifecycleManagerTests.swift index e83f8cd8..312e85d4 100644 --- a/Tests/AblyChatTests/RoomLifecycleManagerTests.swift +++ b/Tests/AblyChatTests/RoomLifecycleManagerTests.swift @@ -28,14 +28,7 @@ struct RoomLifecycleManagerTests { } private func createManager( - contributors: [RoomLifecycleManager.Contributor] = [], - clock: SimpleClock = MockSimpleClock() - ) -> RoomLifecycleManager { - .init(contributors: contributors, logger: TestLogger(), clock: clock) - } - - private func createManager( - forTestingWhatHappensWhenCurrentlyIn current: RoomLifecycle, + forTestingWhatHappensWhenCurrentlyIn current: RoomLifecycle? = nil, contributors: [RoomLifecycleManager.Contributor] = [], clock: SimpleClock = MockSimpleClock() ) -> RoomLifecycleManager {