[no-issue] error image resolver mimetype should not be part of datatable (#3415)

* move error image custom logic form datatable to documentlist

* change travis

* [fix-test-log] added optional function to data row interface

* [no-issue] fixed datatable tests

* [no-issue] fixing tests
This commit is contained in:
Eugenio Romano
2018-06-08 00:27:01 +02:00
committed by GitHub
parent 346dff436d
commit 08fd49c4e3
16 changed files with 131 additions and 99 deletions

View File

@@ -31,27 +31,23 @@ describe('ProcessFiltersComponent', () => {
let mockErrorFilterPromise;
beforeEach(() => {
fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
resolve([
new FilterProcessRepresentationModel({
name: 'FakeInvolvedTasks',
filter: { state: 'open', assignment: 'fake-involved' }
}),
new FilterProcessRepresentationModel({
name: 'FakeMyTasks',
filter: { state: 'open', assignment: 'fake-assignee' }
}),
new FilterProcessRepresentationModel({
name: 'Running',
filter: { state: 'open', assignment: 'fake-running' }
})
]);
});
fakeGlobalFilterPromise = Promise.resolve([
new FilterProcessRepresentationModel({
name: 'FakeInvolvedTasks',
filter: { state: 'open', assignment: 'fake-involved' }
}),
new FilterProcessRepresentationModel({
name: 'FakeMyTasks',
filter: { state: 'open', assignment: 'fake-assignee' }
}),
new FilterProcessRepresentationModel({
name: 'Running',
filter: { state: 'open', assignment: 'fake-running' }
})
]);
mockErrorFilterPromise = new Promise(function (resolve, reject) {
reject({
error: 'wrong request'
});
mockErrorFilterPromise = Promise.reject({
error: 'wrong request'
});
processFilterService = new ProcessFilterService(null);
@@ -96,12 +92,7 @@ describe('ProcessFiltersComponent', () => {
});
it('should return the filter task list, filtered By Name', (done) => {
let fakeDeployedApplicationsPromise = new Promise(function (resolve, reject) {
resolve({ id: 1 });
});
spyOn(appsProcessService, 'getDeployedApplicationsByName').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
spyOn(appsProcessService, 'getDeployedApplicationsByName').and.returnValue(Observable.fromPromise(Promise.resolve({ id: 1 })));
spyOn(processFilterService, 'getProcessFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
let change = new SimpleChange(null, 'test', true);

View File

@@ -64,9 +64,7 @@ describe('TaskFiltersComponent', () => {
error: 'wrong request'
};
let mockErrorFilterPromise = new Promise(function (resolve, reject) {
reject(mockErrorFilterList);
});
let mockErrorFilterPromise = new Promise.reject(mockErrorFilterList);
let component: TaskFiltersComponent;
let fixture: ComponentFixture<TaskFiltersComponent>;
@@ -180,7 +178,7 @@ describe('TaskFiltersComponent', () => {
it('should select the task filter based on the input by name param', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
component.filterParam = new FilterParamsModel({name: 'FakeMyTasks1'});
component.filterParam = new FilterParamsModel({ name: 'FakeMyTasks1' });
const appId = '1';
let change = new SimpleChange(null, appId, true);
@@ -199,7 +197,7 @@ describe('TaskFiltersComponent', () => {
it('should select the default task filter if filter input does not exist', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
component.filterParam = new FilterParamsModel({name: 'UnexistableFilter'});
component.filterParam = new FilterParamsModel({ name: 'UnexistableFilter' });
const appId = '1';
let change = new SimpleChange(null, appId, true);
@@ -219,7 +217,7 @@ describe('TaskFiltersComponent', () => {
it('should select the task filter based on the input by index param', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
component.filterParam = new FilterParamsModel({index: 2});
component.filterParam = new FilterParamsModel({ index: 2 });
const appId = '1';
let change = new SimpleChange(null, appId, true);
@@ -239,7 +237,7 @@ describe('TaskFiltersComponent', () => {
it('should select the task filter based on the input by id param', (done) => {
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
component.filterParam = new FilterParamsModel({id: 10});
component.filterParam = new FilterParamsModel({ id: 10 });
const appId = '1';
let change = new SimpleChange(null, appId, true);
@@ -289,18 +287,18 @@ describe('TaskFiltersComponent', () => {
expect(component.getFiltersByAppId).toHaveBeenCalledWith(appId);
});
it('should change current filter when filterParam (id) changes', async() => {
it('should change current filter when filterParam (id) changes', async () => {
component.filters = fakeGlobalFilter;
component.currentFilter = null;
fixture.whenStable().then(() => {
expect(component.currentFilter.id).toEqual(fakeGlobalFilter[2].id);
});
const change = new SimpleChange(null, {id : fakeGlobalFilter[2].id}, true);
const change = new SimpleChange(null, { id: fakeGlobalFilter[2].id }, true);
component.ngOnChanges({ 'filterParam': change });
});
it('should change current filter when filterParam (name) changes', async() => {
it('should change current filter when filterParam (name) changes', async () => {
component.filters = fakeGlobalFilter;
component.currentFilter = null;
@@ -308,7 +306,7 @@ describe('TaskFiltersComponent', () => {
expect(component.currentFilter.name).toEqual(fakeGlobalFilter[2].name);
});
const change = new SimpleChange(null, {name : fakeGlobalFilter[2].name}, true);
const change = new SimpleChange(null, { name: fakeGlobalFilter[2].name }, true);
component.ngOnChanges({ 'filterParam': change });
});

View File

@@ -241,7 +241,7 @@ describe('TaskHeaderComponent', () => {
}));
it('should call the service\'s unclaim method on unclaiming', async(() => {
spyOn(service, 'unclaimTask');
spyOn(service, 'unclaimTask').and.returnValue(Observable.of(true));
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
component.refreshData();
fixture.detectChanges();