Fix failing processlist tests

This commit is contained in:
Will Abson
2016-11-29 18:53:23 +00:00
parent 743eaaef01
commit 3f0db4038f
2 changed files with 11 additions and 9 deletions

View File

@@ -154,16 +154,16 @@ describe('ActivitiProcessInstanceListComponent', () => {
expect(component.getCurrentId()).toBeNull(); expect(component.getCurrentId()).toBeNull();
}); });
it('should throw an exception when the response is wrong', (done) => { it('should throw an exception when the response is wrong', fakeAsync(() => {
spyOn(service, 'getProcessInstances').and.returnValue(Observable.throw('Fake server error')); let emitSpy: jasmine.Spy = spyOn(component.onError, 'emit');
let fakeError = 'Fake server error';
spyOn(service, 'getProcessInstances').and.returnValue(Observable.throw(fakeError));
component.appId = '1';
component.state = 'open'; component.state = 'open';
component.onError.subscribe( (err) => {
expect(err).toBeDefined();
expect(err).toBe('Fake server error');
done();
});
fixture.detectChanges(); fixture.detectChanges();
}); tick();
expect(emitSpy).toHaveBeenCalledWith(fakeError);
}));
it('should emit onSuccess event when reload() called', fakeAsync(() => { it('should emit onSuccess event when reload() called', fakeAsync(() => {
spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses)); spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses));

View File

@@ -79,7 +79,9 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
if (!this.data) { if (!this.data) {
this.data = this.initDefaultSchemaColumns(); this.data = this.initDefaultSchemaColumns();
} }
this.reload(); if (this.appId) {
this.reload();
}
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {