Closed Tozarin closed 11 months ago
It depends what you mean physical connection. Can you use sqlite3::memory:
or maybe even disk-backed sqlite3 since it still does not need a network connection? There is a related discussion in #52.
Thanks for answer!
I mean to mock CONNECTION module in code to perform queries without any interactions with db, without passing any db files to code. Use something like this: give me that -> returns user defined data, give it again -> return same data. To testing some application logic that call CONNECTION functions, but not use real db entity.
I think that sqlite3::memory:
could help me, but using dummy db entity seems like uh. If it is common way of testing, then ok.
Isn't it limited what you can test without something behaving like a database? What should e.g. a find
call of a mock connection return? Note that it must return exactly one row according to the API, or an error.
If mock object behaves exactly like db, then it doesn't seem to be limitation. But you are right, this forces to simulate exactly db in order to match API. So, probably, yes, it is easier to use sqlite3::memory:
and not worry.
Thank you for your time.
I want to test my application without physical connection to db. Does caqti have any tools for this?
If this is not supported, are there any ways to do this? By mocking CONNECTION module or something else?