diff --git a/core/src/test/scala/sttp/client4/testing/BackendStubTests.scala b/core/src/test/scala/sttp/client4/testing/BackendStubTests.scala index e295a91e0..1a96ab569 100644 --- a/core/src/test/scala/sttp/client4/testing/BackendStubTests.scala +++ b/core/src/test/scala/sttp/client4/testing/BackendStubTests.scala @@ -387,30 +387,32 @@ class BackendStubTests extends AnyFlatSpec with Matchers with ScalaFutures { result shouldBe Success(Right(1: Byte)) } - it should "run the web socket pipe, for a web socket stream request" in { - var capturedFrame: WebSocketFrame = null - - val backend: WebSocketStreamBackend[Identity, TestStreams] = - WebSocketStreamBackendStub - .synchronous[TestStreams] - .whenAnyRequest - .thenRespondAdjust( - WebSocketStreamConsumer[Identity](TestStreams) { pipe => - capturedFrame = pipe(WebSocketFrame.text("hello")) - }, - if (TestPlatform.Current == TestPlatform.JS) StatusCode.Ok else StatusCode.SwitchingProtocols - ) - - // running for side-effects - val _ = basicRequest - .get(uri"http://example.org") - .response(asWebSocketStream(TestStreams) { - case WebSocketFrame.Text(p, _, _) => WebSocketFrame.text(s"echo: $p") - case f => f - }) - .send(backend) - - capturedFrame shouldBe WebSocketFrame.text("echo: hello") + if (TestPlatform.Current != TestPlatform.JS) { + it should "run the web socket pipe, for a web socket stream request" in { + var capturedFrame: WebSocketFrame = null + + val backend: WebSocketStreamBackend[Identity, TestStreams] = + WebSocketStreamBackendStub + .synchronous[TestStreams] + .whenAnyRequest + .thenRespondAdjust( + WebSocketStreamConsumer[Identity](TestStreams) { pipe => + capturedFrame = pipe(WebSocketFrame.text("hello")) + }, + StatusCode.SwitchingProtocols + ) + + // running for side-effects + val _ = basicRequest + .get(uri"ws://example.org") + .response(asWebSocketStream(TestStreams) { + case WebSocketFrame.Text(p, _, _) => WebSocketFrame.text(s"echo: $p") + case f => f + }) + .send(backend) + + capturedFrame shouldBe WebSocketFrame.text("echo: hello") + } } it should "evaluate side effects on each request" in {