mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-1883] document list preset unit tests (#5519)
* document list preset unit tests * remove useless tests * remove useless tests * remove even more garbage * remove junk
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
|
||||
import { fakeApplicationInstance } from '../mock/app-model.mock';
|
||||
@@ -39,10 +39,6 @@ describe('AppDetailsCloudComponent', () => {
|
||||
component.applicationInstance = fakeApplicationInstance[0];
|
||||
});
|
||||
|
||||
it('should create AppDetailsCloudComponent ', async(() => {
|
||||
expect(component instanceof AppDetailsCloudComponent).toBe(true);
|
||||
}));
|
||||
|
||||
it('should display application name', () => {
|
||||
fixture.detectChanges();
|
||||
const appName = fixture.nativeElement.querySelector('.adf-app-listgrid-item-card-title');
|
||||
|
@@ -58,10 +58,6 @@ describe('AppListCloudComponent', () => {
|
||||
getAppsSpy = spyOn(appsProcessCloudService, 'getDeployedApplicationsByStatus').and.returnValue(of(fakeApplicationInstance));
|
||||
});
|
||||
|
||||
it('should create AppListCloudComponent ', async(() => {
|
||||
expect(component instanceof AppListCloudComponent).toBe(true);
|
||||
}));
|
||||
|
||||
it('should define layoutType with the default value', () => {
|
||||
component.layoutType = '';
|
||||
fixture.detectChanges();
|
||||
|
@@ -872,10 +872,6 @@ describe('FormCloudWithCustomOutComesComponent', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should create instance of FormCloudWithCustomOutComesComponent', () => {
|
||||
expect(component instanceof FormCloudWithCustomOutComesComponent).toBe(true, 'should create FormCloudWithCustomOutComesComponent');
|
||||
});
|
||||
|
||||
it('should be able to inject custom outcomes and click on custom outcomes', () => {
|
||||
fixture.detectChanges();
|
||||
const cancelSpy = spyOn(component, 'onButtonClick').and.callThrough();
|
||||
|
@@ -87,10 +87,6 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should create EditProcessFilterCloudComponent', () => {
|
||||
expect(component instanceof EditProcessFilterCloudComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should fetch process instance filter by id', async(() => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
|
@@ -49,10 +49,6 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create ProcessFilterDialogCloudComponent', () => {
|
||||
expect(component instanceof ProcessFilterDialogCloudComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should get data from MAT_DIALOG_DATA as an input to the dialog', () => {
|
||||
fixture.detectChanges();
|
||||
const mockData = component.data;
|
||||
|
@@ -28,7 +28,6 @@ import { ProcessFiltersCloudModule } from '../process-filters-cloud.module';
|
||||
import { FilterParamsModel } from '../../../task/task-filters/models/filter-cloud.model';
|
||||
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||
import { UserPreferenceCloudService } from '../../../services/user-preference-cloud.service';
|
||||
|
||||
describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
@@ -91,14 +90,6 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
processFilterService = TestBed.get(ProcessFilterCloudService);
|
||||
});
|
||||
|
||||
it('should create ProcessFiltersCloudComponent instance', () => {
|
||||
expect(component instanceof ProcessFiltersCloudComponent).toBeDefined();
|
||||
});
|
||||
|
||||
it('should be able to use LocalPreferenceCloudService', () => {
|
||||
expect(processFilterService.preferenceService instanceof LocalPreferenceCloudService).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should attach specific icon for each filter if hasIcon is true', async(() => {
|
||||
spyOn(processFilterService, 'getProcessFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
@@ -362,32 +353,3 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
expect(component.getCurrentFilter()).toBe(filter);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Set UserPreferenceService', () => {
|
||||
|
||||
let processFilterService: ProcessFilterCloudService;
|
||||
let component: ProcessFiltersCloudComponent;
|
||||
let fixture: ComponentFixture<ProcessFiltersCloudComponent>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [ProcessServiceCloudTestingModule, ProcessFiltersCloudModule],
|
||||
providers: [
|
||||
ProcessFilterCloudService,
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ProcessFiltersCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
processFilterService = TestBed.get(ProcessFilterCloudService);
|
||||
});
|
||||
|
||||
it('should create ProcessFiltersCloudComponent instance', () => {
|
||||
expect(component instanceof ProcessFiltersCloudComponent).toBeDefined();
|
||||
});
|
||||
|
||||
it('should able to inject UserPreferenceCloudService when you override with user preferece service', () => {
|
||||
expect(processFilterService.preferenceService instanceof UserPreferenceCloudService).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@@ -26,15 +26,11 @@ import {
|
||||
fakeProcessCloudFilterWithDifferentEntries,
|
||||
fakeProcessFilter
|
||||
} from '../mock/process-filters.cloud.mock';
|
||||
import { PreferenceCloudServiceInterface } from '../../../services/preference-cloud.interface';
|
||||
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||
import { UserPreferenceCloudService } from '../../../services/user-preference-cloud.service';
|
||||
|
||||
describe('ProcessFilterCloudService', () => {
|
||||
let service: ProcessFilterCloudService;
|
||||
let preferenceCloudService: PreferenceCloudServiceInterface;
|
||||
let identityUserService: IdentityUserService;
|
||||
let getPreferencesSpy: jasmine.Spy;
|
||||
let getPreferenceByKeySpy: jasmine.Spy;
|
||||
let updatePreferenceSpy: jasmine.Spy;
|
||||
@@ -57,8 +53,10 @@ describe('ProcessFilterCloudService', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
service = TestBed.get(ProcessFilterCloudService);
|
||||
preferenceCloudService = service.preferenceService;
|
||||
identityUserService = TestBed.get(IdentityUserService);
|
||||
|
||||
const preferenceCloudService = service.preferenceService;
|
||||
const identityUserService = TestBed.get(IdentityUserService);
|
||||
|
||||
createPreferenceSpy = spyOn(preferenceCloudService, 'createPreference').and.returnValue(of(fakeProcessCloudFilters));
|
||||
updatePreferenceSpy = spyOn(preferenceCloudService, 'updatePreference').and.returnValue(of(fakeProcessCloudFilters));
|
||||
getPreferenceByKeySpy = spyOn(preferenceCloudService, 'getPreferenceByKey').and.returnValue(of(fakeProcessCloudFilters));
|
||||
@@ -66,14 +64,6 @@ describe('ProcessFilterCloudService', () => {
|
||||
getCurrentUserInfoSpy = spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock);
|
||||
}));
|
||||
|
||||
it('should create ProcessFilterCloudService instance', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
|
||||
it('should be able to use LocalPreferenceCloudService', () => {
|
||||
expect(preferenceCloudService instanceof LocalPreferenceCloudService).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should create processfilter key by using appName and the username', (done) => {
|
||||
service.getProcessFilters('mock-appName').subscribe((res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -220,38 +210,3 @@ describe('ProcessFilterCloudService', () => {
|
||||
expect(updatePreferenceSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Inject [UserPreferenceCloudService] into the ProcessFilterCloudService', () => {
|
||||
let service: ProcessFilterCloudService;
|
||||
let preferenceCloudService: PreferenceCloudServiceInterface;
|
||||
let identityUserService: IdentityUserService;
|
||||
|
||||
const identityUserMock = { username: 'mock-username', firstName: 'fake-identity-first-name', lastName: 'fake-identity-last-name', email: 'fakeIdentity@email.com' };
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
ProcessFilterCloudService,
|
||||
IdentityUserService,
|
||||
UserPreferenceCloudService,
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
service = TestBed.get(ProcessFilterCloudService);
|
||||
preferenceCloudService = service.preferenceService;
|
||||
identityUserService = TestBed.get(IdentityUserService);
|
||||
spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock);
|
||||
}));
|
||||
|
||||
it('should create ProcessFilterCloudService instance', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
|
||||
it('should be able to inject UserPreferenceCloudService when you override with user preferece service', () => {
|
||||
expect(preferenceCloudService instanceof UserPreferenceCloudService).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@@ -224,10 +224,6 @@ describe('ProcessListCloudComponent', () => {
|
||||
fixtureCustom.destroy();
|
||||
});
|
||||
|
||||
it('should create instance of CustomTaskListComponent', () => {
|
||||
expect(componentCustom instanceof CustomTaskListComponent).toBe(true, 'should create CustomTaskListComponent');
|
||||
});
|
||||
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
fixture.detectChanges();
|
||||
expect(componentCustom.processListCloud.columnList).toBeDefined();
|
||||
|
@@ -74,10 +74,6 @@ describe('StartProcessCloudComponent', () => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
it('should create instance of StartProcessInstanceComponent', () => {
|
||||
expect(fixture.componentInstance instanceof StartProcessCloudComponent).toBe(true, 'should create StartProcessInstanceComponent');
|
||||
});
|
||||
|
||||
describe('start a process without start form', () => {
|
||||
|
||||
it('should be able to start a process with a valid process name and process definition', async(() => {
|
||||
|
@@ -62,10 +62,6 @@ describe('PreferenceService', () => {
|
||||
getInstanceSpy = spyOn(alfrescoApiMock, 'getInstance').and.returnValue(apiMock(mockPreferences));
|
||||
}));
|
||||
|
||||
it('should create UserPreferenceCloudService instance', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return the preferences', (done) => {
|
||||
service.getPreferences('mock-app-name').subscribe((res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
|
@@ -84,10 +84,6 @@ describe('StartTaskCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create instance of StartTaskCloudComponent', () => {
|
||||
expect(component instanceof StartTaskCloudComponent).toBe(true, 'should create StartTaskCloudComponent');
|
||||
});
|
||||
|
||||
describe('create task', () => {
|
||||
|
||||
it('should create new task when start button is clicked', async(() => {
|
||||
|
@@ -1,30 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TaskCloudModule } from './task-cloud.module';
|
||||
|
||||
describe('TaskCloudModule', () => {
|
||||
let taskCloudModule: TaskCloudModule;
|
||||
|
||||
beforeEach(() => {
|
||||
taskCloudModule = new TaskCloudModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(taskCloudModule).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -48,10 +48,6 @@ describe('TaskFilterDialogCloudComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should create TaskFilterDialogCloudComponent', () => {
|
||||
expect(component instanceof TaskFilterDialogCloudComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should get data from MAT_DIALOG_DATA as an input to the dialog', () => {
|
||||
fixture.detectChanges();
|
||||
const mockData = component.data;
|
||||
|
@@ -28,7 +28,6 @@ import { By } from '@angular/platform-browser';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { TaskFiltersCloudModule } from '../task-filters-cloud.module';
|
||||
import { fakeGlobalFilter } from '../mock/task-filters-cloud.mock';
|
||||
import { UserPreferenceCloudService } from '../../../services/user-preference-cloud.service';
|
||||
|
||||
describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
@@ -68,14 +67,6 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
taskFilterService = TestBed.get(TaskFilterCloudService);
|
||||
});
|
||||
|
||||
it('should create TaskFiltersCloudComponent instance', () => {
|
||||
expect(component instanceof TaskFiltersCloudComponent).toBeDefined();
|
||||
});
|
||||
|
||||
it('should be able to use LocalPreferenceCloudService', () => {
|
||||
expect(taskFilterService.preferenceService instanceof LocalPreferenceCloudService).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should attach specific icon for each filter if hasIcon is true', async(() => {
|
||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
@@ -342,33 +333,3 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
expect(component.getCurrentFilter()).toBe(fakeGlobalFilter[0]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Set UserPreferenceService', () => {
|
||||
|
||||
let component: TaskFiltersCloudComponent;
|
||||
let taskFilterService: TaskFilterCloudService;
|
||||
let fixture: ComponentFixture<TaskFiltersCloudComponent>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule],
|
||||
providers: [
|
||||
TaskFilterCloudService,
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TaskFiltersCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
taskFilterService = TestBed.get(TaskFilterCloudService);
|
||||
});
|
||||
|
||||
it('should create TaskFiltersCloudComponent instance', () => {
|
||||
expect(component instanceof TaskFiltersCloudComponent).toBeDefined();
|
||||
});
|
||||
|
||||
it('should be able to inject UserPreferenceCloudService when you override with user preferece service', () => {
|
||||
expect(taskFilterService.preferenceService instanceof UserPreferenceCloudService).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@@ -44,8 +44,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
|
||||
describe('TaskFilterCloudService', () => {
|
||||
let service: TaskFilterCloudService;
|
||||
let preferenceCloudService: PreferenceCloudServiceInterface;
|
||||
let identityUserService: IdentityUserService;
|
||||
|
||||
let getPreferencesSpy: jasmine.Spy;
|
||||
let getPreferenceByKeySpy: jasmine.Spy;
|
||||
let createPreferenceSpy: jasmine.Spy;
|
||||
@@ -72,17 +71,15 @@ describe('TaskFilterCloudService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(TaskFilterCloudService);
|
||||
preferenceCloudService = service.preferenceService;
|
||||
identityUserService = TestBed.get(IdentityUserService);
|
||||
|
||||
const preferenceCloudService = service.preferenceService;
|
||||
createPreferenceSpy = spyOn(preferenceCloudService, 'createPreference').and.returnValue(of(fakeTaskCloudFilters));
|
||||
updatePreferenceSpy = spyOn(preferenceCloudService, 'updatePreference').and.returnValue(of(fakeTaskCloudFilters));
|
||||
getPreferencesSpy = spyOn(preferenceCloudService, 'getPreferences').and.returnValue(of(fakeTaskCloudPreferenceList));
|
||||
getPreferenceByKeySpy = spyOn(preferenceCloudService, 'getPreferenceByKey').and.returnValue(of(fakeTaskCloudFilters));
|
||||
getCurrentUserInfoSpy = spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock);
|
||||
});
|
||||
|
||||
it('should be able to use UserPreferenceCloudService', () => {
|
||||
expect(preferenceCloudService instanceof UserPreferenceCloudService).toBeTruthy();
|
||||
const identityUserService = TestBed.get(IdentityUserService);
|
||||
getCurrentUserInfoSpy = spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock);
|
||||
});
|
||||
|
||||
it('should create task filter key by using appName and the username', (done) => {
|
||||
@@ -261,10 +258,6 @@ describe('Inject [LocalPreferenceCloudService] into the TaskFilterCloudService',
|
||||
spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock);
|
||||
});
|
||||
|
||||
it('should be able to inject LocalPreferenceCloudService when you override with user preference service', () => {
|
||||
expect(preferenceCloudService instanceof LocalPreferenceCloudService).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should create default task filters if there are no task filter preferences', (done) => {
|
||||
const appName = 'fakeAppName';
|
||||
service.getTaskListFilters(appName).subscribe((res) => {
|
||||
|
@@ -1,30 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TaskFiltersCloudModule } from './task-filters-cloud.module';
|
||||
|
||||
describe('TaskFiltersCloudModule', () => {
|
||||
let taskFiltersCloudModule: TaskFiltersCloudModule;
|
||||
|
||||
beforeEach(() => {
|
||||
taskFiltersCloudModule = new TaskFiltersCloudModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(taskFiltersCloudModule).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -72,10 +72,6 @@ describe('TaskFormCloudComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should create TaskFormCloudComponent ', () => {
|
||||
expect(component instanceof TaskFormCloudComponent).toBe(true);
|
||||
});
|
||||
|
||||
describe('Complete button', () => {
|
||||
|
||||
it('should show complete button when status is ASSIGNED', async(() => {
|
||||
@@ -467,10 +463,6 @@ describe('TaskFormWithCustomOutComesComponent', () => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should create instance of TaskFormWithCustomOutComesComponent', () => {
|
||||
expect(component instanceof TaskFormWithCustomOutComesComponent).toBe(true, 'should create TaskFormWithCustomOutComesComponent');
|
||||
});
|
||||
|
||||
it('should be able to display and click on cancel button', () => {
|
||||
fixture.detectChanges();
|
||||
const cancelSpy = spyOn(component, 'onCancel').and.callThrough();
|
||||
|
@@ -272,10 +272,6 @@ describe('TaskListCloudComponent', () => {
|
||||
copyFixture.destroy();
|
||||
});
|
||||
|
||||
it('should create instance of CustomTaskListComponent', () => {
|
||||
expect(componentCustom instanceof CustomTaskListComponent).toBe(true, 'should create CustomTaskListComponent');
|
||||
});
|
||||
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
fixture.detectChanges();
|
||||
expect(componentCustom.taskList.columnList).toBeDefined();
|
||||
|
Reference in New Issue
Block a user