configureWTransportForTest function

void configureWTransportForTest()

Configure w_transport for use in tests, allowing you to easily mock out the behavior of the w_transport classes.

Implementation

void configureWTransportForTest() {
  // The previous behavior of mocked requests/WebSockets is that they would
  // enter a "pending" queue if there were no expectations/handlers set up to
  // handle them. Then the `verifyNoOutstandingExceptions()` method would throw
  // if that "pending" queue was not empty.
  //
  // Enabling fall-through breaks this behavior because requests/WebSockets
  // without an expectation/handler will result in a switch to a real instance
  // which would throw if no other TransportPlatform instance is configured.
  //
  // So, for backwards compatibility, we disable fall-through.
  MockTransports.install(fallThrough: false);
}