docs(readme): use `after()` over `ready()` in example
This PR addresses an issue where using the ready method causes the application to get stuck when running unit tests. To resolve this, the after method is used instead, ensuring that the necessary logic is executed without blocking the test execution.
Changes:
Replaced `ready` method with `after` to prevent test execution from getting stuck.
Reason for Change:
The `ready` method can introduce unexpected behavior in unit test environments, leading to tests hanging indefinitely.
The `after` method ensures the required logic is executed after initialization without interfering with test execution.
Testing:
Ran unit tests successfully without any hanging issues.
Verified the functionality remains unchanged in the main application.
There is also wrong variable name in the example. Should be:
-fastify.register(fastifySchedulePlugin);
+fastify.register(fastifySchedule);
There is also wrong variable name in the example. Should be:
-fastify.register(fastifySchedulePlugin); +fastify.register(fastifySchedule);
You're right. I'm going to update PR now.
@hungnb94, the unit tests in this repo use ready() and they appear okay. Could you clarify on the issue, maybe with an example? Thanks!
@hungnb94, the unit tests in this repo use
ready()and they appear okay. Could you clarify on the issue, maybe with an example? Thanks!
You can check branch dev here: https://github.com/hungnb94/fastify-demo/tree/dev I think the problem related to AutoLoad feature