mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -37,6 +37,11 @@ describe('ActivitiStartProcessButton', () => {
|
||||
let startProcessSpy: jasmine.Spy;
|
||||
let debugElement: DebugElement;
|
||||
|
||||
let newProcess = {
|
||||
id: '32323',
|
||||
name: 'Process'
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ CoreModule, ActivitiFormModule ],
|
||||
@@ -66,10 +71,7 @@ describe('ActivitiStartProcessButton', () => {
|
||||
id: 'my:process2',
|
||||
name: 'My Process 2'
|
||||
}]));
|
||||
startProcessSpy = spyOn(processService, 'startProcess').and.returnValue(Observable.of({
|
||||
id: '32323',
|
||||
name: 'Process'
|
||||
}));
|
||||
startProcessSpy = spyOn(processService, 'startProcess').and.returnValue(Observable.of(newProcess));
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
@@ -128,6 +130,19 @@ describe('ActivitiStartProcessButton', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should output start event when process started successfully', (done) => {
|
||||
let emitSpy = spyOn(component.start, 'emit');
|
||||
component.name = 'My new process';
|
||||
component.processDefinitionId = 'my:process1';
|
||||
component.showDialog();
|
||||
fixture.detectChanges();
|
||||
component.startProcess();
|
||||
fixture.whenStable().then(() => {
|
||||
expect(emitSpy).toHaveBeenCalledWith(newProcess);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should indicate start form is missing when process does not have a start form', (done) => {
|
||||
component.name = 'My new process';
|
||||
component.processDefinitionId = 'my:process1';
|
||||
|
Reference in New Issue
Block a user