Skip to content
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

Merged
merged 3 commits into from
Mar 6, 2023

Conversation

kevchuang
Copy link
Contributor

This PR addresses #87.

@kevchuang kevchuang changed the title Replace WireMock with STTP WIP: Replace WireMock with STTP Mar 5, 2023
@kevchuang kevchuang marked this pull request as draft March 5, 2023 21:29
@kevchuang kevchuang changed the title WIP: Replace WireMock with STTP Replace WireMock with STTP Mar 5, 2023
@kevchuang kevchuang marked this pull request as ready for review March 5, 2023 21:39
dbulaja98
dbulaja98 previously approved these changes Mar 6, 2023
Copy link
Member

@drmarjanovic drmarjanovic left a 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])
Copy link
Member

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.

Copy link
Contributor Author

@kevchuang kevchuang Mar 6, 2023

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]) {
Copy link
Member

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. 😄

Copy link
Contributor Author

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")
Copy link
Member

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(
Copy link
Member

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(
Copy link
Member

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?

@drmarjanovic drmarjanovic merged commit fc37410 into lambdaworks:main Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants