ngxs-examples
ngxs-examples copied to clipboard
unit tests
This lib is really great, but I'm trying to make an effort to unit test all of my code and I was hoping to find examples of unit tests. Specifically the DI piece and mocking the NGXS pieces.
When my component constructor takes in the store as a constructor and I import NgxsModule.forRoot([MyState]) in the TestBed my tests still fail w/ "Can't resolve all parameters for <COMPONENT>".
This would be a great repo to show how to unit test an app that uses NGXS including mocking.
@markwhitfeld @arturovt
I was complicating things by using jest w/ the jest-presets-angular package and experimental decorators were turned off which screwed up the DI in my testbed. I feel a lot more sane now that the DI is working and I can mock Store.
Still, I think adding unit tests to the examples is a good idea and I'm willing to contribute to this repo personally.
Thanks @gforceg, I welcome any contributions you would like to make to this.