@@ -77,35 +77,4 @@ final class FaceLivenessDetectionViewModelTestCase: XCTestCase {
7777 viewModel. livenessState. faceMatched ( )
7878 XCTAssertEqual ( viewModel. livenessState. state, . faceMatched)
7979 }
80-
81- /// Given: A `FaceLivenessDetectionViewModel`
82- /// When: The viewModel state `.countingDown` and receives
83- /// an event from the face detector with `.noFace`
84- /// Then: The flow bails with an `encounteredUnrecoverableError(.invalidFaceMovementDuringCountdown)`
85- var stateChangeCancellable : Set < AnyCancellable > !
86- func testInvalidFaceMovementDuringCountdown( ) {
87- stateChangeCancellable = Set < AnyCancellable > ( )
88- viewModel. livenessService = MockLivenessService ( )
89- viewModel. livenessState. checkIsFacePrepared ( )
90- viewModel. livenessState. startCountdown ( )
91- XCTAssertEqual ( viewModel. livenessState. state, . countingDown)
92-
93- let stateChangeExpectation = expectation (
94- description: " waiting on state change after invalid face movement "
95- )
96-
97- viewModel. $livenessState
98- . drop ( while: { $0. state == . countingDown } )
99- . sink { stateMachine in
100- XCTAssertEqual (
101- stateMachine. state,
102- . encounteredUnrecoverableError( . invalidFaceMovementDuringCountdown)
103- )
104- stateChangeExpectation. fulfill ( )
105- }
106- . store ( in: & stateChangeCancellable)
107-
108- viewModel. process ( newResult: . noFace)
109- wait ( for: [ stateChangeExpectation] , timeout: 0.1 )
110- }
11180}
0 commit comments