Skip to content

Commit

Permalink
Fix upickle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Dec 18, 2024
1 parent e0c83f5 commit 042f9a0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class UpickleTests extends AnyFlatSpec with Matchers with EitherValues {
RunResponseAs(responseAs)(body).right.value shouldBe expected
}

it should "decode None from empty array body" in {
it should "decode None from empty body" in {
import UsingDefaultReaderWriters._
import sttp.client4.upicklejson.default._

val responseAs = asJson[Option[Inner]]

RunResponseAs(responseAs)("[]").right.value shouldBe None
RunResponseAs(responseAs)("").right.value shouldBe None
}

it should "decode Left(None) from upickle notation" in {
Expand All @@ -49,7 +49,7 @@ class UpickleTests extends AnyFlatSpec with Matchers with EitherValues {

val responseAs = asJson[Either[Option[Inner], Outer]]

RunResponseAs(responseAs)("[0,[]]").right.value shouldBe Left(None)
RunResponseAs(responseAs)("[0,null]").right.value shouldBe Left(None)
}

it should "decode Right(None) from upickle notation" in {
Expand All @@ -58,7 +58,7 @@ class UpickleTests extends AnyFlatSpec with Matchers with EitherValues {

val responseAs = asJson[Either[Outer, Option[Inner]]]

RunResponseAs(responseAs)("[1,[]]").right.value shouldBe Right(None)
RunResponseAs(responseAs)("[1,null]").right.value shouldBe Right(None)
}

it should "fail to decode from empty input" in {
Expand Down

0 comments on commit 042f9a0

Please sign in to comment.