loopback-next
loopback-next copied to clipboard
Application works as expected, but unit tests fail in with 404 NotFoundError
Describe the bug
I created a simple application with lb4 cli, and it works fine when I run it. However, when I run a unit test, all controller, and repository tests fail. During the test, my application starts and the application init and start events both fire, and I successfully create a client using createRestAppClient. The home page works and so does the explorer page. However, the /ping route generates a 404 NotFoundError and the app.getRepository(MyRepository fails with MyRepositiry "is not bound to any value in context". What am I missing?
Logs
ResolutionError: The key 'repositories.MyRepository' is not bound to any value in context MyApplication-roGIIRWyRTi6GQlKUsHn_Q-0 (context: MyApplication-roGIIRWyRTi6GQlKUsHn_Q-0, binding: repositories.MyRepository)
Additional information
No response
Reproduction
Upcoming