-
I would like to turn my services into pure functions. However, for that, I need to make a mock of lucid, removing the part that accesses the db. I'm still learning S.O.L.I.D. Any ideas on how to make this mock with dependency injection? If someone can share some code, it would help me a lot to continue with my studies. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Mocking database is not a good idea coz after that, all you are testing is that a call was made to a function and nothing else. I am not sure, if you are learning about testing, since many books oversell the idea of mocking and I am strictly against mocking until you are trying to mock a function that has a side-effect. |
Beta Was this translation helpful? Give feedback.
-
I found a similar structure reproduced in Adonis -> https://github.com/waqaradil/AdonisRepo |
Beta Was this translation helpful? Give feedback.
I found a similar structure reproduced in Adonis -> https://github.com/waqaradil/AdonisRepo