We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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(); }); // ... });
[x] Yes (Assistance is provided if you need help submitting a pull request) [ ] No
The text was updated successfully, but these errors were encountered:
feat(schematics): add option to use MockStore in container tests (#2029)
6905d52
Closes #2028
feat(schematics): add option to use MockStore in container tests (ngr…
19ee1b3
…x#2029) Closes ngrx#2028
Successfully merging a pull request may close this issue.
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
The text was updated successfully, but these errors were encountered: