I created an ApiService
class to be able to handle our custom API queries, while using our own serializer + other features.
ApiSer
The issue wasn't really solved in the chosen answer, which is really just a recommendation for writing tests, but rather in the comments, and you have to follow a link and search for it there. Since I had another issue with the same error, I'll add both solutions here.
If you have a barrel (index.ts or multi export file) like this:
export * from 'my.component' // using my.service via DI
export * from 'my.service'
Then you could get an error like EXCEPTION: Can't resolve all parameters for MyComponent: (?)
.
To fix it, you have to export the service before the component:
export * from 'my.service'
export * from 'my.component' // using my.service via DI
The same error can happen due to a circular dependency
which causes an undefined
service import. To check, console.log(YourService)
after importing it (in your test file - where the issue is happening). If it's undefined, you may have made an index.ts file (barrel) exporting both the service and the file using it (component/effect/whatever you're testing) - by importing the service from the index file where both are exported (making it full circle).
Find that file and import the service you need directly from your.service.ts
file instead of the index.