mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
Show only authorized collections list during submission
This commit is contained in:
@@ -8,6 +8,7 @@ import { filter } from 'rxjs/operators';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
|
||||
import { SubmissionServiceStub } from '../../../shared/testing/submission-service-stub';
|
||||
import { mockSubmissionId, mockSubmissionRestResponse } from '../../../shared/mocks/mock-submission';
|
||||
@@ -24,7 +25,7 @@ import { PaginatedList } from '../../../core/data/paginated-list';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { createTestComponent } from '../../../shared/testing/utils';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||
|
||||
const subcommunities = [Object.assign(new Community(), {
|
||||
name: 'SubCommunity 1',
|
||||
@@ -125,6 +126,12 @@ const mockCommunity2 = Object.assign(new Community(), {
|
||||
const mockCommunityList = observableOf(new RemoteData(true, true, true,
|
||||
undefined, new PaginatedList(new PageInfo(), [mockCommunity, mockCommunity2])));
|
||||
|
||||
const mockCommunityCollectionList = observableOf(new RemoteData(true, true, true,
|
||||
undefined, new PaginatedList(new PageInfo(), [mockCommunity1Collection1, mockCommunity1Collection2])));
|
||||
|
||||
const mockCommunity2CollectionList = observableOf(new RemoteData(true, true, true,
|
||||
undefined, new PaginatedList(new PageInfo(), [mockCommunity2Collection1, mockCommunity2Collection2])));
|
||||
|
||||
const mockCollectionList = [
|
||||
{
|
||||
communities: [
|
||||
@@ -193,6 +200,11 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
const communityDataService: any = jasmine.createSpyObj('communityDataService', {
|
||||
findAll: jasmine.createSpy('findAll')
|
||||
});
|
||||
|
||||
const collectionDataService: any = jasmine.createSpyObj('collectionDataService', {
|
||||
getAuthorizedCollectionByCommunity: jasmine.createSpy('getAuthorizedCollectionByCommunity')
|
||||
});
|
||||
|
||||
const store: any = jasmine.createSpyObj('store', {
|
||||
dispatch: jasmine.createSpy('dispatch'),
|
||||
select: jasmine.createSpy('select')
|
||||
@@ -214,6 +226,7 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
TestComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: CollectionDataService, useValue: collectionDataService },
|
||||
{ provide: SubmissionJsonPatchOperationsService, useClass: SubmissionJsonPatchOperationsServiceStub },
|
||||
{ provide: SubmissionService, useClass: SubmissionServiceStub },
|
||||
{ provide: CommunityDataService, useValue: communityDataService },
|
||||
@@ -284,6 +297,7 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
|
||||
it('should init collection list properly', () => {
|
||||
communityDataService.findAll.and.returnValue(mockCommunityList);
|
||||
collectionDataService.getAuthorizedCollectionByCommunity.and.returnValues(mockCommunityCollectionList, mockCommunity2CollectionList);
|
||||
|
||||
comp.ngOnChanges({
|
||||
currentCollectionId: new SimpleChange(null, collectionId, true)
|
||||
|
Reference in New Issue
Block a user