Skip to content

Commit

Permalink
Reenable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Sep 18, 2024
1 parent d4b3ebb commit c6c9128
Show file tree
Hide file tree
Showing 4 changed files with 457 additions and 465 deletions.
4 changes: 1 addition & 3 deletions Sources/StreamVideo/Controllers/CallController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,7 @@ class CallController: @unchecked Sendable {
func cleanUp() {
guard call != nil else { return }
call = nil
Task {
await webRTCCoordinator.cleanUp()
}
Task { await webRTCCoordinator.cleanUp() }
}

/// Collects user feedback asynchronously.
Expand Down
35 changes: 35 additions & 0 deletions StreamVideoTests/Call/Call_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,41 @@ final class Call_Tests: StreamVideoTestCase {
XCTAssertTrue(Int(duration) >= 1)
}

// MARK: - Update State from Coordinator events

func test_coordinatorEventReceived_startedRecording_updatesStateCorrectly() async throws {
try await assertCoordinatorEventReceived(
.typeCallRecordingStartedEvent(
CallRecordingStartedEvent(callCid: callCid, createdAt: Date())
)
) { call in await fulfillment { call.state.recordingState == .recording } }
}

func test_coordinatorEventReceived_startedRecordingForAnotherCall_doesNotUpdateState() async throws {
try await assertCoordinatorEventReceived(
.typeCallRecordingStartedEvent(
CallRecordingStartedEvent(callCid: .unique, createdAt: Date())
)
) { @MainActor call in
await wait(for: 1)
XCTAssertEqual(call.state.recordingState, .noRecording)
}
}

private func assertCoordinatorEventReceived(
_ event: VideoEvent,
fulfillmentHandler: @MainActor (Call) async throws -> Void
) async throws {
let streamVideo = try XCTUnwrap(streamVideo)
let call = streamVideo.call(callType: callType, callId: callId)

streamVideo
.eventNotificationCenter
.process(.coordinatorEvent(event))

try await fulfillmentHandler(call)
}

// MARK: - join

func test_join_callControllerWasCalledOnlyOnce() async throws {
Expand Down
Loading

0 comments on commit c6c9128

Please sign in to comment.