Skip to content

Commit

Permalink
Disable test on JS
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Feb 5, 2025
1 parent 610f16b commit e6410f3
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions core/src/test/scala/sttp/client4/testing/BackendStubTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e6410f3

Please sign in to comment.