Skip to content

Commit

Permalink
Reformat with scalafmt 3.8.0
Browse files Browse the repository at this point in the history
Executed command: scalafmt --non-interactive
  • Loading branch information
scala-steward committed Feb 20, 2024
1 parent 23bf4aa commit 4c53115
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ object PekkoStreams extends PekkoStreams {
def limitBytes(stream: Source[ByteString, Any], maxBytes: Long): Source[ByteString, Any] = {
stream
.limitWeighted(maxBytes)(_.length.toLong)
.mapError {
case _: pekko.stream.StreamLimitReachedException => StreamMaxLengthExceededException(maxBytes)
.mapError { case _: pekko.stream.StreamLimitReachedException =>
StreamMaxLengthExceededException(maxBytes)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ class PekkoStreamsTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll
val stream = PekkoStreams.limitBytes(inputStream, maxBytes)

// then
stream.fold(0L)((acc, bs) => acc + bs.length).runWith(TestSink[Long]()).request(1).expectNext(inputByteCount.toLong).expectComplete()
stream
.fold(0L)((acc, bs) => acc + bs.length)
.runWith(TestSink[Long]())
.request(1)
.expectNext(inputByteCount.toLong)
.expectComplete()
}

it should "Fail stream if limit is exceeded" in {
Expand All @@ -51,7 +56,7 @@ class PekkoStreamsTest extends AnyFlatSpec with Matchers with BeforeAndAfterAll
Source.fromIterator(() => iterator.grouped(chunkSize).map(group => ByteString(group.toArray)))

// when
val stream = PekkoStreams.limitBytes(inputStream, maxBytes)
val stream = PekkoStreams.limitBytes(inputStream, maxBytes)
val probe = stream.runWith(TestSink[ByteString]())
val _ = for (_ <- 1 to 31) yield probe.requestNext()

Expand Down

0 comments on commit 4c53115

Please sign in to comment.