-
Notifications
You must be signed in to change notification settings - Fork 18
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 WireMock with STTP #103
Replace WireMock with STTP #103
Conversation
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.
Great job once again! I have several comments regarding the convention we use. Thanks 🙏🏻
|
||
trait SttpBackendStubSpec extends ZIOSpecDefault { | ||
|
||
case class StubMapping(request: Request[_, _] => Boolean, response: Response[Any]) |
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.
We prefer using final
for case classes.
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.
Adding final
gives me a warning during compilation:
The outer reference in this type test cannot be checked at run time. final case class StubMapping(request: Request[_, _] => Boolean, response: Response[Any])
Do you have any idea on how to get rid of this warning while keeping final
?
|
||
case class StubMapping(request: Request[_, _] => Boolean, response: Response[Any]) | ||
|
||
final implicit class SttpBackendStubImplicits[T](sttpBackendStub: SttpBackendStub[Task, T]) { |
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.
Does it make sense to use SttpBackendStubOps
convention? Also, let's use [A]
, instead of [T]
. I always feel like T
is Java convention/leftover. 😄
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.
It makes totally sense !
.thenRespond(stubMapping.response) | ||
} | ||
|
||
val index: IndexName = IndexName("repositories") |
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.
If index
, repo
and url
can be made private
we should do that.
|
||
val url = "http://localhost:9200" | ||
|
||
val bulkRequestStub: StubMapping = StubMapping( |
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.
Let's make all of those private if possible.
getByQueryRequestStub | ||
) | ||
|
||
val sttpBackendStubLayer: TaskLayer[SttpBackendStub[Task, Any]] = ZLayer.succeed( |
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.
This can be private as well, right?
…ivate in SttpBackendStubSpec
3774cec
to
5394fbc
Compare
This PR addresses #87.