Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to CE v3.5.0-RC3, FS2 v3.7.0-RC2 #73

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ ThisBuild / githubWorkflowBuildPreamble +=
cond = Some("matrix.project == 'rootNodeJS'")
)

val ceVersion = "3.4.8"
val fs2Version = "3.6.1"
val ceVersion = "3.5.0-RC3"
val fs2Version = "3.7.0-RC2"
val sjsDomVersion = "2.4.0"
val munitCEVersion = "2.0.0-M3"
val scalaCheckEffectVersion = "2.0.0-M2"
Expand Down
3 changes: 2 additions & 1 deletion dom/src/main/scala/fs2/dom/StreamConverters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ private[dom] object StreamConverters {
Stream.bracket(F.delay(readableStream.getReader()))(r => F.delay(r.releaseLock())).flatMap {
reader =>
Stream.unfoldChunkEval(reader) { reader =>
F.fromPromise(F.delay(reader.read())).map { chunk =>
// cleanup on cancellation is handled by outer bracket
F.fromPromiseCancelable(F.delay((reader.read(), F.unit))).map { chunk =>
if (chunk.done)
None
else
Expand Down
12 changes: 12 additions & 0 deletions tests/src/test/scala/fs2/dom/StreamConversionSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import munit.CatsEffectSuite
import munit.ScalaCheckEffectSuite
import org.scalacheck.effect.PropF.forAllF

import scala.concurrent.duration._

class StreamConversionSuite extends CatsEffectSuite with ScalaCheckEffectSuite {

test("to/read ReadableStream") {
Expand All @@ -38,4 +40,14 @@ class StreamConversionSuite extends CatsEffectSuite with ScalaCheckEffectSuite {
}
}

test("cancelable") {
Stream
.never[IO]
.through(toReadableStream[IO])
.flatMap(readable => readReadableStream(IO(readable)))
.compile
.drain
.timeoutTo(100.millis, IO.unit)
}

}