i am writing unit tests for my repository that use...
# squarelibraries
w
i am writing unit tests for my repository that uses sqldelight for it’s data. I was hoping to mock out the generated queries class with my own in memory version. I cannot extend the queries class since it is not
open
. is there any suggested alternative to achieve this?
j
If it's sqlite use an in-memory database. If it's mysql or postgres then I would suggest a testcontainers rule.
👀 1
👍 2
You can look at our own tests which do this
w
thanks jake
c
interesting that you suggest in memory database with sqlite but not postgres (im intrigued because im an android dev so 99% sqlite, but dipping my toes into ktor server with postgres!)
j
Testcontainers is effectively in memory postgres
❤️ 1
h
Alternatively, you can mock your repository, if you use a repository architecture.