@@ -142,26 +142,29 @@ actor MockTyping: Typing {
142
142
let roomID : String
143
143
let channel : RealtimeChannel
144
144
145
+ private var mockSubscription : MockTypingSubscription
146
+
145
147
init ( clientID: String , roomID: String ) {
146
148
self . clientID = clientID
147
149
self . roomID = roomID
148
150
self . channel = MockRealtimeChannel ( )
151
+ self . mockSubscription = MockTypingSubscription ( clientID: clientID, roomID: roomID)
149
152
}
150
153
151
154
func subscribe( bufferingPolicy: BufferingPolicy ) -> Subscription < TypingEvent > {
152
- . init( mockAsyncSequence: MockTypingSubscription ( clientID : clientID , roomID : roomID ) )
155
+ . init( mockAsyncSequence: mockSubscription )
153
156
}
154
157
155
158
func get( ) async throws -> Set < String > {
156
159
Set ( MockStrings . names. prefix ( 2 ) )
157
160
}
158
161
159
162
func start( ) async throws {
160
- fatalError ( " Not yet implemented " )
163
+ mockSubscription . emit ( )
161
164
}
162
165
163
166
func stop( ) async throws {
164
- fatalError ( " Not yet implemented " )
167
+ mockSubscription . emit ( )
165
168
}
166
169
167
170
func subscribeToDiscontinuities( ) async -> Subscription < ARTErrorInfo > {
@@ -173,9 +176,12 @@ actor MockPresence: Presence {
173
176
let clientID : String
174
177
let roomID : String
175
178
179
+ private var mockSubscription : MockPresenceSubscription
180
+
176
181
init ( clientID: String , roomID: String ) {
177
182
self . clientID = clientID
178
183
self . roomID = roomID
184
+ self . mockSubscription = MockPresenceSubscription ( clientID: clientID, roomID: roomID)
179
185
}
180
186
181
187
func get( ) async throws -> any PaginatedResult < PresenceMember > {
@@ -191,11 +197,11 @@ actor MockPresence: Presence {
191
197
}
192
198
193
199
func enter( ) async throws {
194
- fatalError ( " Not yet implemented " )
200
+ mockSubscription . emitPresenceEvent ( clientID : clientID , event : . enter )
195
201
}
196
202
197
203
func enter( data: PresenceData ) async throws {
198
- fatalError ( " Not yet implemented " )
204
+ mockSubscription . emitPresenceEvent ( clientID : clientID , event : . enter )
199
205
}
200
206
201
207
func update( ) async throws {
@@ -207,19 +213,19 @@ actor MockPresence: Presence {
207
213
}
208
214
209
215
func leave( ) async throws {
210
- fatalError ( " Not yet implemented " )
216
+ mockSubscription . emitPresenceEvent ( clientID : clientID , event : . leave )
211
217
}
212
218
213
219
func leave( data: PresenceData ) async throws {
214
- fatalError ( " Not yet implemented " )
220
+ mockSubscription . emitPresenceEvent ( clientID : clientID , event : . leave )
215
221
}
216
222
217
223
func subscribe( event: PresenceEventType ) -> Subscription < PresenceEvent > {
218
- . init( mockAsyncSequence: MockPresenceSubscription ( clientID : clientID , roomID : roomID ) )
224
+ . init( mockAsyncSequence: mockSubscription )
219
225
}
220
226
221
227
func subscribe( events: [ PresenceEventType ] ) -> Subscription < PresenceEvent > {
222
- . init( mockAsyncSequence: MockPresenceSubscription ( clientID : clientID , roomID : roomID ) )
228
+ . init( mockAsyncSequence: mockSubscription )
223
229
}
224
230
225
231
func subscribeToDiscontinuities( ) async -> Subscription < ARTErrorInfo > {
0 commit comments