async-http-client icon indicating copy to clipboard operation
async-http-client copied to clipboard

Add unit tests for `NWWaitingHandler`

Open dnadoba opened this issue 3 years ago • 0 comments

When we added NWWaitingHandler in https://github.com/swift-server/async-http-client/pull/588 we didn’t add a unit test for the NWWaitingHandler. This is because we need to make an enhancement to NIOTransportServices to make the WaitingForConnectivity event initialiser public. This is tracked as a separate issue in https://github.com/apple/swift-nio-transport-services/issues/147 and must be resolved first.

The unit test can be implemented by using an EmbeddedChannel and sending an NIOTSNetworkEvents.WaitingForConnectivity through fireUserInboundEventTriggered(_:). An example usage of EmbeddedChannel and fireUserInboundEventTriggered(_:) can be found here: https://github.com/swift-server/async-http-client/blob/3fcd67061f17d105282701c8ebd32467e458ceb6/Tests/AsyncHTTPClientTests/TLSEventsHandlerTests.swift#L24-L32

This should be straight forward and a good first starter issue. If you have more questions please don't hesitate to ask here.

dnadoba avatar Jun 02 '22 13:06 dnadoba