-
Notifications
You must be signed in to change notification settings - Fork 75
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
Replace foldLeft with traverse in Decoders #101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
==========================================
+ Coverage 87.81% 88.14% +0.32%
==========================================
Files 36 36
Lines 517 506 -11
Branches 3 3
==========================================
- Hits 454 446 -8
+ Misses 63 60 -3
Continue to review full report at Codecov.
|
it should "return an error for an empty list" in { | ||
decode[NonEmptyList[Int]](emptyListResponse) should be('left) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be worth it to add a test case for a single element because I think that's why this decoder is here for in the first place.
Something like:
case class Foo(a: Int)
it should "return a valid NonEmtpyList for a valid JSON" in {
decode[NonEmptyList[Foo]]("""{"a": 1}""") should be(Right(NonEmptyList.of(Foo(1))))
}
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this seems to be a bit dodgy decoder, converting both A
and [A]
, but as that seems what is needed, I'll add that test 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, the github api and its quirks ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @peterneyens !
No description provided.