Skip to content

Commit

Permalink
Add test for new case
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoncal committed Apr 2, 2024
1 parent f5547e7 commit 560c62a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ internal class HAResponseControllerImpl: HAResponseController {
phase = .disconnected(error: error, forReset: false)
case .peerClosed:
HAGlobal.log(.info, "Peer closed")
phase = .disconnected(error: nil, forReset: false)
}
}

Expand Down
8 changes: 8 additions & 0 deletions Tests/HAResponseController.test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ internal class HAResponseControllerTests: XCTestCase {
}
}

func testPeerClosedEvent() {
fireConnected()
controller.didReceive(event: .peerClosed)
waitForCallback()
XCTAssertEqual(delegate.lastPhase, .disconnected(error: nil, forReset: false))
XCTAssertNil(delegate.lastReceived)
}

func testAuthFlow() throws {
fireConnected()
try fireText(
Expand Down

0 comments on commit 560c62a

Please sign in to comment.