点击后我需要检查按钮是否调用了调度。 这是真的吗?
it('should remove dispatch on click', async(() => {
const hds = fixture.debugElement.injector.get(ngrx.Store);
const saveSpy = spyOn(hds, 'dispatch');
click(page.removeGeospatialBtn);
expect(saveSpy.calls.count()).toBe(1);}));
并想知道fakeStore应该如何看待。我能想出的最好的
TestBed.configureTestingModule({
imports: [
GeneralModule
],
providers: [
{provide: APP_BASE_HREF, useValue: '/'},
{provide: ngrx.Store, useClass: class {
dispatch(action: Action) {
}
}},
]
}).compileComponents();