The test file generated by the container schematic is currently importing the StoreModule:
// ...
import { Store, StoreModule } from '@ngrx/store';
describe('ExampleComponent', () => {
// ...
let store: Store<any>;
beforeEach(async() => {
TestBed.configureTestingModule({
imports: [ StoreModule.forRoot({}) ], // <--- Outdated
declarations: [ ExampleComponent ]
});
await TestBed.compileComponents();
});
beforeEach(() => {
// ...
store = TestBed.get<Store>(Store);
spyOn(store, 'dispatch').and.callThrough();
fixture.detectChanges();
});
// ...
});
Instead, the schematic should use MockStore:
// ...
import { provideMockStore, MockStore } from '@ngrx/store/testing';
describe('ExampleComponent', () => {
// ...
let store: MockStore<any>;
beforeEach(async() => {
TestBed.configureTestingModule({
providers: [ provideMockStore() ],
declarations: [ ExampleComponent ]
});
await TestBed.compileComponents();
});
beforeEach(() => {
// ...
store = TestBed.get(Store);
fixture.detectChanges();
});
// ...
});
If accepted, I would be willing to submit a PR for this feature
[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
The test file generated by the container schematic is currently importing the StoreModule:
Instead, the schematic should use MockStore:
If accepted, I would be willing to submit a PR for this feature
[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No