mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -54,6 +54,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
let fixture: ComponentFixture<ActivitiProcessInstanceListComponent>;
|
let fixture: ComponentFixture<ActivitiProcessInstanceListComponent>;
|
||||||
let component: ActivitiProcessInstanceListComponent;
|
let component: ActivitiProcessInstanceListComponent;
|
||||||
let service: ActivitiProcessService;
|
let service: ActivitiProcessService;
|
||||||
|
let getProcessInstancesSpy: jasmine.Spy;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -71,6 +72,8 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
service = fixture.debugElement.injector.get(ActivitiProcessService);
|
service = fixture.debugElement.injector.get(ActivitiProcessService);
|
||||||
|
|
||||||
|
getProcessInstancesSpy = spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses));
|
||||||
|
|
||||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||||
'upgradeAllRegistered',
|
'upgradeAllRegistered',
|
||||||
'upgradeElement'
|
'upgradeElement'
|
||||||
@@ -106,7 +109,6 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
|
|
||||||
it('should emit onSuccess event when process instances loaded', fakeAsync(() => {
|
it('should emit onSuccess event when process instances loaded', fakeAsync(() => {
|
||||||
let emitSpy = spyOn(component.onSuccess, 'emit');
|
let emitSpy = spyOn(component.onSuccess, 'emit');
|
||||||
spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses));
|
|
||||||
component.appId = '1';
|
component.appId = '1';
|
||||||
component.state = 'open';
|
component.state = 'open';
|
||||||
component.processDefinitionKey = null;
|
component.processDefinitionKey = null;
|
||||||
@@ -116,7 +118,6 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return the process instances list', (done) => {
|
it('should return the process instances list', (done) => {
|
||||||
spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses));
|
|
||||||
component.appId = '1';
|
component.appId = '1';
|
||||||
component.state = 'open';
|
component.state = 'open';
|
||||||
component.processDefinitionKey = null;
|
component.processDefinitionKey = null;
|
||||||
@@ -133,7 +134,6 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return the process instances list filtered by processDefinitionKey', (done) => {
|
it('should return the process instances list filtered by processDefinitionKey', (done) => {
|
||||||
spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses));
|
|
||||||
component.appId = '1';
|
component.appId = '1';
|
||||||
component.state = 'open';
|
component.state = 'open';
|
||||||
component.processDefinitionKey = 'fakeprocess';
|
component.processDefinitionKey = 'fakeprocess';
|
||||||
@@ -157,7 +157,7 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
it('should throw an exception when the response is wrong', fakeAsync(() => {
|
it('should throw an exception when the response is wrong', fakeAsync(() => {
|
||||||
let emitSpy: jasmine.Spy = spyOn(component.onError, 'emit');
|
let emitSpy: jasmine.Spy = spyOn(component.onError, 'emit');
|
||||||
let fakeError = 'Fake server error';
|
let fakeError = 'Fake server error';
|
||||||
spyOn(service, 'getProcessInstances').and.returnValue(Observable.throw(fakeError));
|
getProcessInstancesSpy.and.returnValue(Observable.throw(fakeError));
|
||||||
component.appId = '1';
|
component.appId = '1';
|
||||||
component.state = 'open';
|
component.state = 'open';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -166,7 +166,6 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
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));
|
|
||||||
component.appId = '1';
|
component.appId = '1';
|
||||||
component.state = 'open';
|
component.state = 'open';
|
||||||
component.processDefinitionKey = null;
|
component.processDefinitionKey = null;
|
||||||
@@ -179,7 +178,6 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should reload processes when reload() is called', (done) => {
|
it('should reload processes when reload() is called', (done) => {
|
||||||
spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses));
|
|
||||||
component.data = new ObjectDataTableAdapter(
|
component.data = new ObjectDataTableAdapter(
|
||||||
[],
|
[],
|
||||||
[
|
[
|
||||||
@@ -217,7 +215,6 @@ describe('ActivitiProcessInstanceListComponent', () => {
|
|||||||
describe('component changes', () => {
|
describe('component changes', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(service, 'getProcessInstances').and.returnValue(Observable.of(fakeGlobalProcesses));
|
|
||||||
component.data = new ObjectDataTableAdapter(
|
component.data = new ObjectDataTableAdapter(
|
||||||
[],
|
[],
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user