Skip to content

Commit

Permalink
refactor(schematics): Update container schematic to generate test fil…
Browse files Browse the repository at this point in the history
…e using MockStore
  • Loading branch information
ijz953 committed Jul 21, 2019
1 parent 136c5eb commit 999e71e
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';
import { Store, StoreModule } from '@ngrx/store';
import { provideMockStore, MockStore } from '@ngrx/store/testing';

describe('<%= classify(name) %>Component', () => {
let component: <%= classify(name) %>Component;
let fixture: ComponentFixture<<%= classify(name) %>Component>;
let store: Store<any>;
let store: MockStore<any>;

beforeEach(async() => {
TestBed.configureTestingModule({
imports: [ StoreModule.forRoot({}) ],
providers: [ provideMockStore() ],
declarations: [ <%= classify(name) %>Component ]
});

Expand All @@ -20,9 +20,8 @@ describe('<%= classify(name) %>Component', () => {
beforeEach(() => {
fixture = TestBed.createComponent(<%= classify(name) %>Component);
component = fixture.componentInstance;
store = TestBed.get<Store>(Store);
store = TestBed.get(Store);

spyOn(store, 'dispatch').and.callThrough();
fixture.detectChanges();
});

Expand Down

0 comments on commit 999e71e

Please sign in to comment.