Skip to content

Commit

Permalink
add reproducible test case
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 committed Aug 6, 2024
1 parent 66d3eea commit 2c5ecbd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions zio-http/jvm/src/test/scala/zio/http/codec/PathCodecSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ object PathCodecSpec extends ZIOHttpSpec {
)
},
),
suite("UUID segment decoding")(
test("UUID segment decoding") {
val codec = PathCodec.empty / "api" / PathCodec.uuid("entityId")
val uuid = UUID.randomUUID()
val path = Path(s"/api/$uuid")
assertTrue(codec.decode(path) == Right(uuid))
},
test("UUID segment matches") {
val codec = SegmentCodec.uuid("entityId")
val uuid = UUID.randomUUID().toString()
val path = Chunk("api", uuid)
assertTrue(codec.matches(path, 1) == 1)
},
),
suite("decoding with sub-segment codecs")(
test("int") {
val codec = PathCodec.empty /
Expand Down

0 comments on commit 2c5ecbd

Please sign in to comment.