Mocking drizzle
Hello
I am having such a hard time to mock drizzle for some unit tests, are there any official guides out there that I can take a look at?
I've tried
- test containers (for integration tests, I know, its diff..), the issue here is that I'm using drizzle-orm/neon-serverless and this package talks through http and not TCP
- tried to mock drizzle but I'm having a hard time due to the nature of the api
I have a hono api with 5 simple endpoints and I cannot test it due to the drizzle mocks, I'm sure other developers have faced this?
2 Replies
Does this help?
https://github.com/drizzle-team/drizzle-orm/blob/main/integration-tests/tests/pg/neon-serverless.test.ts
GitHub
drizzle-orm/integration-tests/tests/pg/neon-serverless.test.ts at m...
Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅 - drizzle-team/drizzle-orm
so what I did was different, I created integration tests with the help of testcontainers and WHOA, I loved the approach and I get to test my api with real dependencies instead of mocking dependencies
Its pretty fast for the 22 tests that I have