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

Testing with TranzactIO #17

Closed
RobinJDCox opened this issue Oct 19, 2020 · 4 comments
Closed

Testing with TranzactIO #17

RobinJDCox opened this issue Oct 19, 2020 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@RobinJDCox
Copy link

TranzactIO looks really interesting library, great work! 🙂 I'm looking at solving exactly the kind of problem you've described where I can complete my transaction after performing multiple DB operations and various bits if business logic.

My question is around testing, is there a recommended approach when using TranzactIO? If my database classes return a RIO[Connection, A] and my core service logic completes that transaction, resulting in a RIO[Database, A] it would be great to be able to provide implementations of Connection and Database that don't require a running SQL database.

@PawelJ-PL
Copy link

I'm using TranzactIO in my project. For tests I've prepared fake connection source layer like: https://github.com/PawelJ-PL/elevation_of_privilege_online/blob/master/src/test/scala/com/github/paweljpl/eoponline/testdoubles/FakeConnectionSource.scala. Thanks to I'm able to use it in my tests, for example https://github.com/PawelJ-PL/elevation_of_privilege_online/blob/be161a6fe6873e9cd117b22a7af7567fe5a0e426/src/test/scala/com/github/paweljpl/eoponline/game/GamesSpec.scala#L53. Of course, I don't know if this is the recommended approach, if there are any others, I'd be happy to see them.

@RobinJDCox
Copy link
Author

That works for my use-case, thanks for the suggestion!

@gaelrenoux gaelrenoux added the enhancement New feature or request label Nov 8, 2020
@gaelrenoux
Copy link
Owner

I haven't missed that and I think it's a great idea, I just don't have had the time yet. I thought I could work on it today, but issue 18 took priority.

@gaelrenoux
Copy link
Owner

Solved in #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants