mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge remote-tracking branch 'upstream/master' into w2p-70504_New-user-registration
This commit is contained in:
@@ -191,15 +191,15 @@ describe('ItemBitstreamsComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('when dropBitstream is called', () => {
|
describe('when dropBitstream is called', () => {
|
||||||
const event = {
|
beforeEach((done) => {
|
||||||
fromIndex: 0,
|
comp.dropBitstream(bundle, {
|
||||||
toIndex: 50,
|
fromIndex: 0,
|
||||||
// tslint:disable-next-line:no-empty
|
toIndex: 50,
|
||||||
finish: () => {}
|
// tslint:disable-next-line:no-empty
|
||||||
};
|
finish: () => {
|
||||||
|
done();
|
||||||
beforeEach(() => {
|
}
|
||||||
comp.dropBitstream(bundle, event);
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should send out a patch for the move operation', () => {
|
it('should send out a patch for the move operation', () => {
|
||||||
|
@@ -210,13 +210,16 @@ describe('CommunityListService', () => {
|
|||||||
let flatNodeList;
|
let flatNodeList;
|
||||||
describe('None expanded: should return list containing only flatnodes of the test top communities page 1 and 2', () => {
|
describe('None expanded: should return list containing only flatnodes of the test top communities page 1 and 2', () => {
|
||||||
let findTopSpy;
|
let findTopSpy;
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
findTopSpy = spyOn(communityDataServiceStub, 'findTop').and.callThrough();
|
findTopSpy = spyOn(communityDataServiceStub, 'findTop').and.callThrough();
|
||||||
service.getNextPageTopCommunities();
|
service.getNextPageTopCommunities();
|
||||||
|
|
||||||
const sub = service.loadCommunities(null)
|
service.loadCommunities(null)
|
||||||
.subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('flatnode list should contain just flatnodes of top community list page 1 and 2', () => {
|
it('flatnode list should contain just flatnodes of top community list page 1 and 2', () => {
|
||||||
expect(findTopSpy).toHaveBeenCalled();
|
expect(findTopSpy).toHaveBeenCalled();
|
||||||
@@ -236,10 +239,13 @@ describe('CommunityListService', () => {
|
|||||||
describe('should transform all communities in a list of flatnodes with possible subcoms and collections as subflatnodes if they\'re expanded', () => {
|
describe('should transform all communities in a list of flatnodes with possible subcoms and collections as subflatnodes if they\'re expanded', () => {
|
||||||
let flatNodeList;
|
let flatNodeList;
|
||||||
describe('None expanded: should return list containing only flatnodes of the test top communities', () => {
|
describe('None expanded: should return list containing only flatnodes of the test top communities', () => {
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const sub = service.loadCommunities(null)
|
service.loadCommunities(null)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be as big as top community list', () => {
|
it('length of flatnode list should be as big as top community list', () => {
|
||||||
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length);
|
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length);
|
||||||
@@ -256,7 +262,7 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('All top expanded, all page 1: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
describe('All top expanded, all page 1: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const expandedNodes = [];
|
const expandedNodes = [];
|
||||||
mockListOfTopCommunitiesPage1.map((community: Community) => {
|
mockListOfTopCommunitiesPage1.map((community: Community) => {
|
||||||
const communityFlatNode = toFlatNode(community, observableOf(true), 0, true, null);
|
const communityFlatNode = toFlatNode(community, observableOf(true), 0, true, null);
|
||||||
@@ -264,9 +270,12 @@ describe('CommunityListService', () => {
|
|||||||
communityFlatNode.currentCommunityPage = 1;
|
communityFlatNode.currentCommunityPage = 1;
|
||||||
expandedNodes.push(communityFlatNode);
|
expandedNodes.push(communityFlatNode);
|
||||||
});
|
});
|
||||||
const sub = service.loadCommunities(expandedNodes)
|
service.loadCommunities(expandedNodes)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be as big as top community list and size of its possible page-limited children', () => {
|
it('length of flatnode list should be as big as top community list and size of its possible page-limited children', () => {
|
||||||
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length + mockSubcommunities1Page1.length + mockSubcommunities1Page1.length);
|
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length + mockSubcommunities1Page1.length + mockSubcommunities1Page1.length);
|
||||||
@@ -281,14 +290,17 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Just first top comm expanded, all page 1: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
describe('Just first top comm expanded, all page 1: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const communityFlatNode = toFlatNode(mockListOfTopCommunitiesPage1[0], observableOf(true), 0, true, null);
|
const communityFlatNode = toFlatNode(mockListOfTopCommunitiesPage1[0], observableOf(true), 0, true, null);
|
||||||
communityFlatNode.currentCollectionPage = 1;
|
communityFlatNode.currentCollectionPage = 1;
|
||||||
communityFlatNode.currentCommunityPage = 1;
|
communityFlatNode.currentCommunityPage = 1;
|
||||||
const expandedNodes = [communityFlatNode];
|
const expandedNodes = [communityFlatNode];
|
||||||
const sub = service.loadCommunities(expandedNodes)
|
service.loadCommunities(expandedNodes)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be as big as top community list and size of page-limited children of first top community', () => {
|
it('length of flatnode list should be as big as top community list and size of page-limited children of first top community', () => {
|
||||||
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length + mockSubcommunities1Page1.length);
|
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length + mockSubcommunities1Page1.length);
|
||||||
@@ -300,14 +312,17 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Just second top comm expanded, collections at page 2: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
describe('Just second top comm expanded, collections at page 2: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const communityFlatNode = toFlatNode(mockListOfTopCommunitiesPage1[1], observableOf(true), 0, true, null);
|
const communityFlatNode = toFlatNode(mockListOfTopCommunitiesPage1[1], observableOf(true), 0, true, null);
|
||||||
communityFlatNode.currentCollectionPage = 2;
|
communityFlatNode.currentCollectionPage = 2;
|
||||||
communityFlatNode.currentCommunityPage = 1;
|
communityFlatNode.currentCommunityPage = 1;
|
||||||
const expandedNodes = [communityFlatNode];
|
const expandedNodes = [communityFlatNode];
|
||||||
const sub = service.loadCommunities(expandedNodes)
|
service.loadCommunities(expandedNodes)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be as big as top community list and size of page-limited children of second top community', () => {
|
it('length of flatnode list should be as big as top community list and size of page-limited children of second top community', () => {
|
||||||
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length + mockCollectionsPage1.length + mockCollectionsPage2.length);
|
expect(flatNodeList.length).toEqual(mockListOfTopCommunitiesPage1.length + mockCollectionsPage1.length + mockCollectionsPage2.length);
|
||||||
@@ -333,10 +348,13 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
let flatNodeList;
|
let flatNodeList;
|
||||||
describe('None expanded: should return list containing only flatnodes of the communities in the test list', () => {
|
describe('None expanded: should return list containing only flatnodes of the communities in the test list', () => {
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const sub = service.transformListOfCommunities(new PaginatedList(new PageInfo(), listOfCommunities), 0, null, null)
|
service.transformListOfCommunities(new PaginatedList(new PageInfo(), listOfCommunities), 0, null, null)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be as big as community test list', () => {
|
it('length of flatnode list should be as big as community test list', () => {
|
||||||
expect(flatNodeList.length).toEqual(listOfCommunities.length);
|
expect(flatNodeList.length).toEqual(listOfCommunities.length);
|
||||||
@@ -353,7 +371,7 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('All top expanded, all page 1: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
describe('All top expanded, all page 1: should return list containing flatnodes of the communities in the test list and all its possible page-limited children (subcommunities and collections)', () => {
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const expandedNodes = [];
|
const expandedNodes = [];
|
||||||
listOfCommunities.map((community: Community) => {
|
listOfCommunities.map((community: Community) => {
|
||||||
const communityFlatNode = toFlatNode(community, observableOf(true), 0, true, null);
|
const communityFlatNode = toFlatNode(community, observableOf(true), 0, true, null);
|
||||||
@@ -361,9 +379,12 @@ describe('CommunityListService', () => {
|
|||||||
communityFlatNode.currentCommunityPage = 1;
|
communityFlatNode.currentCommunityPage = 1;
|
||||||
expandedNodes.push(communityFlatNode);
|
expandedNodes.push(communityFlatNode);
|
||||||
});
|
});
|
||||||
const sub = service.transformListOfCommunities(new PaginatedList(new PageInfo(), listOfCommunities), 0, null, expandedNodes)
|
service.transformListOfCommunities(new PaginatedList(new PageInfo(), listOfCommunities), 0, null, expandedNodes)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be as big as community test list and size of its possible children', () => {
|
it('length of flatnode list should be as big as community test list and size of its possible children', () => {
|
||||||
expect(flatNodeList.length).toEqual(listOfCommunities.length + mockSubcommunities1Page1.length + mockSubcommunities1Page1.length);
|
expect(flatNodeList.length).toEqual(listOfCommunities.length + mockSubcommunities1Page1.length + mockSubcommunities1Page1.length);
|
||||||
@@ -397,10 +418,13 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
let flatNodeList;
|
let flatNodeList;
|
||||||
describe('should return list containing only flatnode corresponding to that community', () => {
|
describe('should return list containing only flatnode corresponding to that community', () => {
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const sub = service.transformCommunity(communityWithNoSubcomsOrColls, 0, null, null)
|
service.transformCommunity(communityWithNoSubcomsOrColls, 0, null, null)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be 1', () => {
|
it('length of flatnode list should be 1', () => {
|
||||||
expect(flatNodeList.length).toEqual(1);
|
expect(flatNodeList.length).toEqual(1);
|
||||||
@@ -426,10 +450,14 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
let flatNodeList;
|
let flatNodeList;
|
||||||
describe('should return list containing only flatnode corresponding to that community', () => {
|
describe('should return list containing only flatnode corresponding to that community', () => {
|
||||||
beforeAll(() => {
|
beforeAll((done) => {
|
||||||
const sub = service.transformCommunity(communityWithSubcoms, 0, null, null)
|
service.transformCommunity(communityWithSubcoms, 0, null, null)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
it('length of flatnode list should be 1', () => {
|
it('length of flatnode list should be 1', () => {
|
||||||
expect(flatNodeList.length).toEqual(1);
|
expect(flatNodeList.length).toEqual(1);
|
||||||
@@ -455,14 +483,17 @@ describe('CommunityListService', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
let flatNodeList;
|
let flatNodeList;
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
const communityFlatNode = toFlatNode(communityWithSubcoms, observableOf(true), 0, true, null);
|
const communityFlatNode = toFlatNode(communityWithSubcoms, observableOf(true), 0, true, null);
|
||||||
communityFlatNode.currentCollectionPage = 1;
|
communityFlatNode.currentCollectionPage = 1;
|
||||||
communityFlatNode.currentCommunityPage = 1;
|
communityFlatNode.currentCommunityPage = 1;
|
||||||
const expandedNodes = [communityFlatNode];
|
const expandedNodes = [communityFlatNode];
|
||||||
const sub = service.transformCommunity(communityWithSubcoms, 0, null, expandedNodes)
|
service.transformCommunity(communityWithSubcoms, 0, null, expandedNodes)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('list of flatnodes is length is 1 + nrOfSubcoms & first flatnode is of expanded test community', () => {
|
it('list of flatnodes is length is 1 + nrOfSubcoms & first flatnode is of expanded test community', () => {
|
||||||
expect(flatNodeList.length).toEqual(1 + mockSubcommunities1Page1.length);
|
expect(flatNodeList.length).toEqual(1 + mockSubcommunities1Page1.length);
|
||||||
@@ -485,7 +516,7 @@ describe('CommunityListService', () => {
|
|||||||
describe('should return list containing flatnodes of that community, its collections of the first two pages', () => {
|
describe('should return list containing flatnodes of that community, its collections of the first two pages', () => {
|
||||||
let communityWithCollections;
|
let communityWithCollections;
|
||||||
let flatNodeList;
|
let flatNodeList;
|
||||||
beforeEach(() => {
|
beforeEach((done) => {
|
||||||
communityWithCollections = Object.assign(new Community(), {
|
communityWithCollections = Object.assign(new Community(), {
|
||||||
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
@@ -500,9 +531,12 @@ describe('CommunityListService', () => {
|
|||||||
communityFlatNode.currentCollectionPage = 2;
|
communityFlatNode.currentCollectionPage = 2;
|
||||||
communityFlatNode.currentCommunityPage = 1;
|
communityFlatNode.currentCommunityPage = 1;
|
||||||
const expandedNodes = [communityFlatNode];
|
const expandedNodes = [communityFlatNode];
|
||||||
const sub = service.transformCommunity(communityWithCollections, 0, null, expandedNodes)
|
service.transformCommunity(communityWithCollections, 0, null, expandedNodes)
|
||||||
.pipe(take(1)).subscribe((value) => flatNodeList = value);
|
.pipe(take(1))
|
||||||
sub.unsubscribe();
|
.subscribe((value) => {
|
||||||
|
flatNodeList = value;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('list of flatnodes is length is 1 + nrOfCollections & first flatnode is of expanded test community', () => {
|
it('list of flatnodes is length is 1 + nrOfCollections & first flatnode is of expanded test community', () => {
|
||||||
expect(flatNodeList.length).toEqual(1 + mockCollectionsPage1.length + mockCollectionsPage2.length);
|
expect(flatNodeList.length).toEqual(1 + mockCollectionsPage1.length + mockCollectionsPage2.length);
|
||||||
@@ -533,7 +567,7 @@ describe('CommunityListService', () => {
|
|||||||
|
|
||||||
describe('getIsExpandable', () => {
|
describe('getIsExpandable', () => {
|
||||||
describe('should return true', () => {
|
describe('should return true', () => {
|
||||||
it('if community has subcommunities', () => {
|
it('if community has subcommunities', (done) => {
|
||||||
const communityWithSubcoms = Object.assign(new Community(), {
|
const communityWithSubcoms = Object.assign(new Community(), {
|
||||||
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
@@ -546,9 +580,10 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
service.getIsExpandable(communityWithSubcoms).pipe(take(1)).subscribe((result) => {
|
service.getIsExpandable(communityWithSubcoms).pipe(take(1)).subscribe((result) => {
|
||||||
expect(result).toEqual(true);
|
expect(result).toEqual(true);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('if community has collections', () => {
|
it('if community has collections', (done) => {
|
||||||
const communityWithCollections = Object.assign(new Community(), {
|
const communityWithCollections = Object.assign(new Community(), {
|
||||||
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
@@ -561,11 +596,12 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
service.getIsExpandable(communityWithCollections).pipe(take(1)).subscribe((result) => {
|
service.getIsExpandable(communityWithCollections).pipe(take(1)).subscribe((result) => {
|
||||||
expect(result).toEqual(true);
|
expect(result).toEqual(true);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('should return false', () => {
|
describe('should return false', () => {
|
||||||
it('if community has neither subcommunities nor collections', () => {
|
it('if community has neither subcommunities nor collections', (done) => {
|
||||||
const communityWithNoSubcomsOrColls = Object.assign(new Community(), {
|
const communityWithNoSubcomsOrColls = Object.assign(new Community(), {
|
||||||
id: 'efbf25e1-2d8c-4c28-8f3e-2e04c215be24',
|
id: 'efbf25e1-2d8c-4c28-8f3e-2e04c215be24',
|
||||||
uuid: 'efbf25e1-2d8c-4c28-8f3e-2e04c215be24',
|
uuid: 'efbf25e1-2d8c-4c28-8f3e-2e04c215be24',
|
||||||
@@ -578,6 +614,7 @@ describe('CommunityListService', () => {
|
|||||||
});
|
});
|
||||||
service.getIsExpandable(communityWithNoSubcomsOrColls).pipe(take(1)).subscribe((result) => {
|
service.getIsExpandable(communityWithNoSubcomsOrColls).pipe(take(1)).subscribe((result) => {
|
||||||
expect(result).toEqual(false);
|
expect(result).toEqual(false);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -11,7 +11,7 @@ export function getMockRequestService(requestEntry$: Observable<RequestEntry> =
|
|||||||
getByUUID: requestEntry$,
|
getByUUID: requestEntry$,
|
||||||
uriEncodeBody: jasmine.createSpy('uriEncodeBody'),
|
uriEncodeBody: jasmine.createSpy('uriEncodeBody'),
|
||||||
isCachedOrPending: false,
|
isCachedOrPending: false,
|
||||||
removeByHrefSubstring: jasmine.createSpy('removeByHrefSubstring').and.returnValue(observableOf(true)),
|
removeByHrefSubstring: observableOf(true),
|
||||||
hasByHrefObservable: observableOf(false)
|
hasByHrefObservable: observableOf(false)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user