test db prepare
- Dominant language
- No language data
- Stars
- 68
- Forks
- 8
- Avg merge
- 11h 2m
- Merged PRs (30d)
- 2
Description
## 💬 How to prepare correctly db for test
I have been scaffolding an app with fastify-cli and I need to create tests that need a preparation phase (before and beforeEach) that uses plugins that are normally automatically loaded with fastify-autoload. These inside helpers and inside test files that are unreachable due to plugin encapsulation.
One of the plugin is the connection to DB, but is not the only one.
One of option that I read is about breaking plugin encapsulation with enclosing the app.js content in to a fastify-plugin. An other is load manually the plugin on before the test.
What is the best practice on this use case?
## Your Environment
- *node version*: 18
- *fastify version*: >=4.15.0
- *os*: Linux
- *any other relevant information*: scaffolding with fastify-cli, tap for test
Contributor guide
Assessment
This issue has not been assessed yet.