While writing unit test for a component which depends on NGRX/Store for some value, i am getting an error saying value is undefined. However same is working fine when i am running the application. The angular app uses Webpack with AOT so don't know if that has something to do with it. I created a sample app and every thing seems to work fine in that. Unit test is successful. However in that Webpack with AOT application, it doesn't seem to work.
See the question on stackoverflow. I don't know whether i need to create a mock store or not, because simply adding the storemodule and adding the service in providers in spec.ts is not doing the needful. The same is working though in a sample app.
While writing unit test for a component which depends on NGRX/Store for some value, i am getting an error saying value is undefined. However same is working fine when i am running the application. The angular app uses Webpack with AOT so don't know if that has something to do with it. I created a sample app and every thing seems to work fine in that. Unit test is successful. However in that Webpack with AOT application, it doesn't seem to work.
See the question on stackoverflow. I don't know whether i need to create a mock store or not, because simply adding the storemodule and adding the service in providers in spec.ts is not doing the needful. The same is working though in a sample app.
https://stackoverflow.com/questions/45253136/creating-a-mockstore-class-to-mock-ngrx-store-to-test-components-with-ngrx-store