"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.spec.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

dynamic-lookup-relation-search-tab.component.spec.ts  (dspace-angular-dspace-7.0):dynamic-lookup-relation-search-tab.component.spec.ts  (dspace-angular-dspace-7.1)
skipping to change at line 22 skipping to change at line 22
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { PaginatedSearchOptions } from '../../../../../search/paginated-search-o ptions.model'; import { PaginatedSearchOptions } from '../../../../../search/paginated-search-o ptions.model';
import { createSuccessfulRemoteDataObject$ } from '../../../../../remote-data.ut ils'; import { createSuccessfulRemoteDataObject$ } from '../../../../../remote-data.ut ils';
import { buildPaginatedList } from '../../../../../../core/data/paginated-list.m odel'; import { buildPaginatedList } from '../../../../../../core/data/paginated-list.m odel';
import { ItemSearchResult } from '../../../../../object-collection/shared/item-s earch-result.model'; import { ItemSearchResult } from '../../../../../object-collection/shared/item-s earch-result.model';
import { Item } from '../../../../../../core/shared/item.model'; import { Item } from '../../../../../../core/shared/item.model';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { LookupRelationService } from '../../../../../../core/data/lookup-relati on.service'; import { LookupRelationService } from '../../../../../../core/data/lookup-relati on.service';
import { PaginationService } from '../../../../../../core/pagination/pagination. service'; import { PaginationService } from '../../../../../../core/pagination/pagination. service';
import { PaginationServiceStub } from '../../../../../testing/pagination-service .stub'; import { PaginationServiceStub } from '../../../../../testing/pagination-service .stub';
import { RelationshipService } from '../../../../../../core/data/relationship.se
rvice';
import { relatedRelationships } from '../../../../../testing/related-relationshi
ps.mock';
import { RelationshipTypeService } from '../../../../../../core/data/relationshi
p-type.service';
import { RelationshipType } from '../../../../../../core/shared/item-relationshi
ps/relationship-type.model';
describe('DsDynamicLookupRelationSearchTabComponent', () => { describe('DsDynamicLookupRelationSearchTabComponent', () => {
let component: DsDynamicLookupRelationSearchTabComponent; let component: DsDynamicLookupRelationSearchTabComponent;
let fixture: ComponentFixture<DsDynamicLookupRelationSearchTabComponent>; let fixture: ComponentFixture<DsDynamicLookupRelationSearchTabComponent>;
let relationship; let relationship;
let pSearchOptions; let pSearchOptions;
let item1; let item1;
let item2; let item2;
let item3; let item3;
let item4; let item4;
let searchResult1; let searchResult1;
let searchResult2; let searchResult2;
let searchResult3; let searchResult3;
let searchResult4; let searchResult4;
let listID; let listID;
let selection$; let selection$;
let results; let results;
let selectableListService; let selectableListService;
let lookupRelationService; let lookupRelationService;
const relationshipService = jasmine.createSpyObj('searchByItemsAndType',{
searchByItemsAndType: observableOf(relatedRelationships)
});
const relationshipType = {
'type': 'relationshiptype',
'id': 1,
'uuid': 'relationshiptype-1',
'leftwardType': 'isAuthorOfPublication',
'leftMaxCardinality': null,
'leftMinCardinality': 0,
'rightwardType': 'isPublicationOfAuthor',
'rightMaxCardinality': null,
'rightMinCardinality': 0,
};
function init() { function init() {
relationship = Object.assign(new RelationshipOptions(), { relationship = Object.assign(new RelationshipOptions(), {
filter: 'filter', filter: 'filter',
relationshipType: 'isAuthorOfPublication', relationshipType: 'isAuthorOfPublication',
nameVariants: true, nameVariants: true,
searchConfiguration: 'personConfig' searchConfiguration: 'personConfig'
}); });
pSearchOptions = new PaginatedSearchOptions({}); pSearchOptions = new PaginatedSearchOptions({});
item1 = Object.assign(new Item(), { uuid: 'e1c51c69-896d-42dc-8221-1d5f2ad55 16e' }); item1 = Object.assign(new Item(), { uuid: 'e1c51c69-896d-42dc-8221-1d5f2ad55 16e' });
skipping to change at line 94 skipping to change at line 113
}, },
{ {
provide: RouteService, useValue: { provide: RouteService, useValue: {
setParameter: () => { setParameter: () => {
// do nothing // do nothing
} }
} }
}, },
{ provide: ActivatedRoute, useValue: { snapshot: { queryParams: {} } } } , { provide: ActivatedRoute, useValue: { snapshot: { queryParams: {} } } } ,
{ provide: LookupRelationService, useValue: lookupRelationService }, { provide: LookupRelationService, useValue: lookupRelationService },
{ provide: PaginationService, useValue: new PaginationServiceStub() } { provide: PaginationService, useValue: new PaginationServiceStub() },
{ provide: RelationshipService, useValue: relationshipService }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(DsDynamicLookupRelationSearchTabComponent) ; fixture = TestBed.createComponent(DsDynamicLookupRelationSearchTabComponent) ;
component = fixture.componentInstance; component = fixture.componentInstance;
component.relationship = relationship; component.relationship = relationship;
component.selection$ = selection$; component.selection$ = selection$;
component.listId = listID; component.listId = listID;
component.isLeft = true;
component.isEditRelationship = true;
component.item = Object.assign(new Item(),{ uuid: 'e2c31c49-846d-45dc-8651-1
d6f2ad8519e' });
component.relationshipType = Object.assign(new RelationshipType(),relationsh
ipType);
fixture.detectChanges(); fixture.detectChanges();
}); });
it('should create', () => { it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
describe('selectPage', () => { describe('selectPage', () => {
beforeEach(() => { beforeEach(() => {
spyOn(component.selectObject, 'emit'); spyOn(component.selectObject, 'emit');
skipping to change at line 161 skipping to change at line 186
beforeEach(() => { beforeEach(() => {
spyOn(component.deselectObject, 'emit'); spyOn(component.deselectObject, 'emit');
component.deselectAll(); component.deselectAll();
}); });
it('should emit the page filtered from not yet selected objects and call sel ect on the service for all objects', () => { it('should emit the page filtered from not yet selected objects and call sel ect on the service for all objects', () => {
expect((component.deselectObject as any).emit).toHaveBeenCalledWith(search Result1, searchResult2); expect((component.deselectObject as any).emit).toHaveBeenCalledWith(search Result1, searchResult2);
expect(selectableListService.deselectAll).toHaveBeenCalledWith(listID); expect(selectableListService.deselectAll).toHaveBeenCalledWith(listID);
}); });
}); });
describe('check searchByItemsAndType', () => {
it('should call relationshipService.searchByItemsAndType', () => {
expect(relationshipService.searchByItemsAndType).toHaveBeenCalled();
});
});
}); });
 End of changes. 5 change blocks. 
1 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)