Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PetterKa committed Aug 14, 2024
1 parent dd4a25a commit c403659
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
34 changes: 24 additions & 10 deletions zio-json/shared/src/test/scala/zio/json/DecoderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,30 @@ object DecoderSpec extends ZIOSpecDefault {
val bad6 = """{"64d7c38d-2afd-X-9832-4e70afe4b0f8": "value"}"""
val bad7 = """{"0-0-0-0-00000000000000000": "value"}"""

assert(ok1.fromJson[Map[UUID, String]])(isRight(equalTo(expectedMap("64d7c38d-2afd-4514-9832-4e70afe4b0f8")))) &&
assert(ok2.fromJson[Map[UUID, String]])(isRight(equalTo(expectedMap("64D7C38D-00FD-0014-0032-0070AfE4B0f8")))) &&
assert(ok3.fromJson[Map[UUID, String]])(isRight(equalTo(expectedMap("00000000-0000-0000-0000-000000000000")))) &&
assert(bad1.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: "))) &&
assert(bad2.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: UUID string too large"))) &&
assert(bad3.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: 64d7c38d-2afd-4514-983-4e70afe4b0f80"))) &&
assert(bad4.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: 64d7c38d-2afd--9832-4e70afe4b0f8"))) &&
assert(bad5.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: 64d7c38d-2afd-XXXX-9832-4e70afe4b0f8"))) &&
assert(bad6.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: 64d7c38d-2afd-X-9832-4e70afe4b0f8"))) &&
assert(bad7.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: 0-0-0-0-00000000000000000")))
assert(ok1.fromJson[Map[UUID, String]])(
isRight(equalTo(expectedMap("64d7c38d-2afd-4514-9832-4e70afe4b0f8")))
) &&
assert(ok2.fromJson[Map[UUID, String]])(
isRight(equalTo(expectedMap("64D7C38D-00FD-0014-0032-0070AfE4B0f8")))
) &&
assert(ok3.fromJson[Map[UUID, String]])(
isRight(equalTo(expectedMap("00000000-0000-0000-0000-000000000000")))
) &&
assert(bad1.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: "))) &&
assert(bad2.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: UUID string too large"))) &&
assert(bad3.fromJson[Map[UUID, String]])(
isLeft(containsString("Invalid UUID: 64d7c38d-2afd-4514-983-4e70afe4b0f80"))
) &&
assert(bad4.fromJson[Map[UUID, String]])(
isLeft(containsString("Invalid UUID: 64d7c38d-2afd--9832-4e70afe4b0f8"))
) &&
assert(bad5.fromJson[Map[UUID, String]])(
isLeft(containsString("Invalid UUID: 64d7c38d-2afd-XXXX-9832-4e70afe4b0f8"))
) &&
assert(bad6.fromJson[Map[UUID, String]])(
isLeft(containsString("Invalid UUID: 64d7c38d-2afd-X-9832-4e70afe4b0f8"))
) &&
assert(bad7.fromJson[Map[UUID, String]])(isLeft(containsString("Invalid UUID: 0-0-0-0-00000000000000000")))
},
test("zio.Chunk") {
val jsonStr = """["5XL","2XL","XL"]"""
Expand Down
4 changes: 3 additions & 1 deletion zio-json/shared/src/test/scala/zio/json/EncoderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ object EncoderSpec extends ZIOSpecDefault {
assert(Map(1 -> "a").toJson)(equalTo("""{"1":"a"}"""))
},
test("Map, UUID keys") {
assert(Map(UUID.fromString("e142f1aa-6e9e-4352-adfe-7e6eb9814ccd") -> "abcd").toJson)(equalTo("""{"e142f1aa-6e9e-4352-adfe-7e6eb9814ccd":"abcd"}"""))
assert(Map(UUID.fromString("e142f1aa-6e9e-4352-adfe-7e6eb9814ccd") -> "abcd").toJson)(
equalTo("""{"e142f1aa-6e9e-4352-adfe-7e6eb9814ccd":"abcd"}""")
)
},
test("java.util.UUID") {
assert(UUID.fromString("e142f1aa-6e9e-4352-adfe-7e6eb9814ccd").toJson)(
Expand Down

0 comments on commit c403659

Please sign in to comment.