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
jw
07/08/2024, 3:35 PM
If it's sqlite use an in-memory database. If it's mysql or postgres then I would suggest a testcontainers rule.
👀 1
👍 2
jw
07/08/2024, 3:36 PM
You can look at our own tests which do this
w
William Reed
07/08/2024, 3:36 PM
thanks jake
c
Colton Idle
07/11/2024, 2:24 PM
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
jw
07/11/2024, 2:29 PM
Testcontainers is effectively in memory postgres
❤️ 1
h
hfhbd
07/20/2024, 5:00 PM
Alternatively, you can mock your repository, if you use a repository architecture.