diff --git a/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts b/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts
index 6c5eb5f591..84edd47e1d 100644
--- a/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts
+++ b/src/app/+community-page/edit-community-page/edit-community-page.component.spec.ts
@@ -1,65 +1,91 @@
-import { CreateCommunityPageComponent } from './create-community-page.component';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommunityDataService } from '../../core/data/community-data.service';
import { RouteService } from '../../shared/services/route.service';
-import { Router } from '@angular/router';
+import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
-import { Observable } from 'rxjs/Observable';
+import { of as observableOf } from 'rxjs';
import { RemoteData } from '../../core/data/remote-data';
import { Community } from '../../core/shared/community.model';
-import { DSOSuccessResponse, ErrorResponse } from '../../core/cache/response-cache.models';
-import { BrowserModule } from '@angular/platform-browser';
import { SharedModule } from '../../shared/shared.module';
import { CommonModule } from '@angular/common';
-import { CommunityFormComponent } from '../community-form/community-form.component';
import { RouterTestingModule } from '@angular/router/testing';
-import { RequestError } from '../../core/data/request.models';
+import { NO_ERRORS_SCHEMA } from '@angular/core';
+import { EditCommunityPageComponent } from './edit-community-page.component';
+import { ActivatedRouteStub } from '../../shared/testing/active-router-stub';
-describe('CreateCommunityPageComponent', () => {
- let comp: CreateCommunityPageComponent;
- let fixture: ComponentFixture
;
+fdescribe('EditCommunityPageComponent', () => {
+ let comp: EditCommunityPageComponent;
+ let fixture: ComponentFixture;
let communityDataService: CommunityDataService;
let routeService: RouteService;
let router: Router;
- const community = Object.assign(new Community(), {
- uuid: 'a20da287-e174-466a-9926-f66b9300d347',
- name: 'test community'
- });
+ let community;
+ let newCommunity;
+ let communityDataServiceStub;
+ let routeServiceStub;
+ let routerStub;
+ let routeStub;
- const newCommunity = Object.assign(new Community(), {
- uuid: '1ff59938-a69a-4e62-b9a4-718569c55d48',
- name: 'new community'
- });
+ function initializeVars() {
+ community = Object.assign(new Community(), {
+ uuid: 'a20da287-e174-466a-9926-f66b9300d347',
+ metadata: [{
+ key: 'dc.title',
+ value: 'test community'
+ }]
+ });
- const communityDataServiceStub = {
- findById: (uuid) => Observable.of(new RemoteData(false, false, true, null, Object.assign(new Community(), {
- uuid: uuid,
- name: community.name
- }))),
- create: (com, uuid?) => Observable.of(new RemoteData(false, false, true, undefined, newCommunity))
- };
- const routeServiceStub = {
- getQueryParameterValue: (param) => Observable.of(community.uuid)
- };
- const routerStub = {
- navigate: (commands) => commands
- };
+ newCommunity = Object.assign(new Community(), {
+ uuid: '1ff59938-a69a-4e62-b9a4-718569c55d48',
+ metadata: [{
+ key: 'dc.title',
+ value: 'new community'
+ }]
+ });
+
+ communityDataServiceStub = {
+ findById: (uuid) => observableOf(new RemoteData(false, false, true, null, Object.assign(new Community(), {
+ uuid: uuid,
+ metadata: [{
+ key: 'dc.title',
+ value: community.name
+ }]
+ }))),
+ update: (com, uuid?) => observableOf(new RemoteData(false, false, true, undefined, newCommunity))
+
+ };
+
+ routeServiceStub = {
+ getQueryParameterValue: (param) => observableOf(community.uuid)
+ };
+ routerStub = {
+ navigate: (commands) => commands
+ };
+
+ routeStub = {
+ data: observableOf(community)
+ };
+
+ }
beforeEach(async(() => {
+ initializeVars();
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
- declarations: [CreateCommunityPageComponent, CommunityFormComponent],
+ declarations: [EditCommunityPageComponent],
providers: [
{ provide: CommunityDataService, useValue: communityDataServiceStub },
{ provide: RouteService, useValue: routeServiceStub },
- { provide: Router, useValue: routerStub }
- ]
+ { provide: Router, useValue: routerStub },
+ { provide: ActivatedRoute, useValue: routeStub },
+ ],
+ schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(CreateCommunityPageComponent);
+ fixture = TestBed.createComponent(EditCommunityPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
communityDataService = (comp as any).communityDataService;
@@ -68,10 +94,15 @@ describe('CreateCommunityPageComponent', () => {
});
describe('onSubmit', () => {
- const data = {
- name: 'test'
- };
-
+ let data;
+ beforeEach(() => {
+ data = Object.assign(new Community(), {
+ metadata: [{
+ key: 'dc.title',
+ value: 'test'
+ }]
+ });
+ });
it('should navigate when successful', () => {
spyOn(router, 'navigate');
comp.onSubmit(data);
@@ -81,7 +112,7 @@ describe('CreateCommunityPageComponent', () => {
it('should not navigate on failure', () => {
spyOn(router, 'navigate');
- spyOn(communityDataService, 'create').and.returnValue(Observable.of(new RemoteData(true, true, false, undefined, newCommunity)));
+ spyOn(communityDataService, 'update').and.returnValue(observableOf(new RemoteData(true, true, false, undefined, newCommunity)));
comp.onSubmit(data);
fixture.detectChanges();
expect(router.navigate).not.toHaveBeenCalled();
diff --git a/src/app/+community-page/edit-community-page/edit-community-page.component.ts b/src/app/+community-page/edit-community-page/edit-community-page.component.ts
index 58805af80a..1528c9e8d5 100644
--- a/src/app/+community-page/edit-community-page/edit-community-page.component.ts
+++ b/src/app/+community-page/edit-community-page/edit-community-page.component.ts
@@ -5,11 +5,8 @@ import { Observable } from 'rxjs';
import { RouteService } from '../../shared/services/route.service';
import { ActivatedRoute, Router } from '@angular/router';
import { RemoteData } from '../../core/data/remote-data';
-import { isNotEmpty } from '../../shared/empty.util';
-import { DSpaceObject } from '../../core/shared/dspace-object.model';
-import { first, map, take, tap } from 'rxjs/operators';
-import { ResourceType } from '../../core/shared/resource-type';
-import { NormalizedCommunity } from '../../core/cache/models/normalized-community.model';
+import { isNotUndefined } from '../../shared/empty.util';
+import { first, map } from 'rxjs/operators';
import { getSucceededRemoteData } from '../../core/shared/operators';
@Component({
@@ -39,8 +36,10 @@ export class EditCommunityPageComponent {
this.communityDataService.update(community)
.pipe(getSucceededRemoteData())
.subscribe((communityRD: RemoteData) => {
- const newUUID = communityRD.payload.uuid;
- this.router.navigate(['/communities/' + newUUID]);
+ if (isNotUndefined(communityRD)) {
+ const newUUID = communityRD.payload.uuid;
+ this.router.navigate(['/communities/' + newUUID]);
+ }
});
}
}
diff --git a/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts
index 0c985e37f9..ace748c7de 100644
--- a/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts
+++ b/src/app/+community-page/sub-community-list/community-page-sub-community-list.component.spec.ts
@@ -17,7 +17,6 @@ describe('SubCommunityList Component', () => {
let fixture: ComponentFixture;
const subcommunities = [Object.assign(new Community(), {
- name: 'SubCommunity 1',
id: '123456789-1',
metadata: [
{
@@ -27,7 +26,6 @@ describe('SubCommunityList Component', () => {
}]
}),
Object.assign(new Community(), {
- name: 'SubCommunity 2',
id: '123456789-2',
metadata: [
{
diff --git a/src/app/+search-page/search-results/search-results.component.spec.ts b/src/app/+search-page/search-results/search-results.component.spec.ts
index 54463d916d..b7ac11553a 100644
--- a/src/app/+search-page/search-results/search-results.component.spec.ts
+++ b/src/app/+search-page/search-results/search-results.component.spec.ts
@@ -111,7 +111,6 @@ export const objects = [
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
type: ResourceType.Community,
- name: 'OR2017 - Demonstration',
metadata: [
{
key: 'dc.description',
@@ -161,7 +160,6 @@ export const objects = [
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
type: ResourceType.Community,
- name: 'Sample Community',
metadata: [
{
key: 'dc.description',
diff --git a/src/app/core/config/config.service.spec.ts b/src/app/core/config/config.service.spec.ts
index 8e9f7db27a..44cfdee358 100644
--- a/src/app/core/config/config.service.spec.ts
+++ b/src/app/core/config/config.service.spec.ts
@@ -36,7 +36,6 @@ describe('ConfigService', () => {
const scopedEndpoint = `${serviceEndpoint}/${scopeName}`;
const searchEndpoint = `${serviceEndpoint}/${BROWSE}?uuid=${scopeID}`;
-
function initTestService(): TestService {
return new TestService(
requestService,
diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts
index ef294c1296..b08b1005b7 100644
--- a/src/app/core/data/collection-data.service.ts
+++ b/src/app/core/data/collection-data.service.ts
@@ -9,7 +9,6 @@ import { ComColDataService } from './comcol-data.service';
import { CommunityDataService } from './community-data.service';
import { RequestService } from './request.service';
import { HALEndpointService } from '../shared/hal-endpoint.service';
-import { AuthService } from '../auth/auth.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { HttpClient } from '@angular/common/http';
import { DataBuildService } from '../cache/builders/data-build.service';
@@ -27,7 +26,6 @@ export class CollectionDataService extends ComColDataService {
protected cds: CommunityDataService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
- protected authService: AuthService,
protected notificationsService: NotificationsService,
protected http: HttpClient,
protected comparator: DSOUpdateComparator,
@@ -56,7 +53,6 @@ describe('ComColDataService', () => {
let requestService: RequestService;
let cds: CommunityDataService;
let objectCache: ObjectCacheService;
- let authService: AuthService;
let halService: any = {};
const rdbService = {} as RemoteDataBuildService;
@@ -106,14 +102,6 @@ describe('ComColDataService', () => {
});
}
- function initMockAuthService(): AuthService {
- return jasmine.createSpyObj('authService', {
- buildAuthHeader: cold('c-', {
- c: authHeader
- })
- });
- }
-
function initTestService(): TestService {
return new TestService(
requestService,
@@ -124,7 +112,6 @@ describe('ComColDataService', () => {
cds,
objectCache,
halService,
- authService,
notificationsService,
http,
comparator,
@@ -137,7 +124,6 @@ describe('ComColDataService', () => {
requestService = getMockRequestService();
objectCache = initMockObjectCacheService();
halService = mockHalService;
- authService = initMockAuthService();
service = initTestService();
});
diff --git a/src/app/core/data/community-data.service.ts b/src/app/core/data/community-data.service.ts
index 40d433a245..63fbe3a21a 100644
--- a/src/app/core/data/community-data.service.ts
+++ b/src/app/core/data/community-data.service.ts
@@ -10,7 +10,6 @@ import { Community } from '../shared/community.model';
import { ComColDataService } from './comcol-data.service';
import { RequestService } from './request.service';
import { HALEndpointService } from '../shared/hal-endpoint.service';
-import { AuthService } from '../auth/auth.service';
import { FindAllOptions, FindAllRequest } from './request.models';
import { RemoteData } from './remote-data';
import { hasValue, isNotEmpty } from '../../shared/empty.util';
@@ -34,7 +33,6 @@ export class CommunityDataService extends ComColDataService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
- protected authService: AuthService,
protected notificationsService: NotificationsService,
protected http: HttpClient,
protected comparator: DSOUpdateComparator
diff --git a/src/app/core/data/config-response-parsing.service.spec.ts b/src/app/core/data/config-response-parsing.service.spec.ts
index caf8ef4a19..a33c5cf5b5 100644
--- a/src/app/core/data/config-response-parsing.service.spec.ts
+++ b/src/app/core/data/config-response-parsing.service.spec.ts
@@ -177,7 +177,7 @@ describe('ConfigResponseParsingService', () => {
'https://rest.api/config/submissionsections/traditionalpagetwo',
'https://rest.api/config/submissionsections/upload',
'https://rest.api/config/submissionsections/license'
- ], 'https://rest.api/config/submissiondefinitions/traditional/sections')
+ ])
});
it('should return a ConfigSuccessResponse if data contains a valid config endpoint response', () => {
diff --git a/src/app/core/data/data.service.spec.ts b/src/app/core/data/data.service.spec.ts
index 7da709abd5..ad6fb5f096 100644
--- a/src/app/core/data/data.service.spec.ts
+++ b/src/app/core/data/data.service.spec.ts
@@ -12,6 +12,11 @@ import { of as observableOf } from 'rxjs';
import { ObjectCacheService } from '../cache/object-cache.service';
import { Operation } from '../../../../node_modules/fast-json-patch';
import { DSpaceObject } from '../shared/dspace-object.model';
+import { AuthService } from '../auth/auth.service';
+import { UpdateComparator } from './update-comparator';
+import { HttpClient } from '@angular/common/http';
+import { DataBuildService } from '../cache/builders/data-build.service';
+import { NotificationsService } from '../../shared/notifications/notifications.service';
const endpoint = 'https://rest.api/core';
@@ -23,10 +28,14 @@ class TestService extends DataService {
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
+ protected dataBuildService: DataBuildService,
protected store: Store,
protected linkPath: string,
protected halService: HALEndpointService,
- protected objectCache: ObjectCacheService
+ protected objectCache: ObjectCacheService,
+ protected notificationsService: NotificationsService,
+ protected http: HttpClient,
+ protected comparator: UpdateComparator
) {
super();
}
@@ -42,6 +51,10 @@ describe('DataService', () => {
const requestService = {} as RequestService;
const halService = {} as HALEndpointService;
const rdbService = {} as RemoteDataBuildService;
+ const notificationsService = {} as NotificationsService;
+ const http = {} as HttpClient;
+ const comparator = {} as any;
+ const dataBuildService = {} as DataBuildService;
const objectCache = {
addPatch: () => {
/* empty */
@@ -56,13 +69,16 @@ describe('DataService', () => {
return new TestService(
requestService,
rdbService,
+ dataBuildService,
store,
endpoint,
halService,
- objectCache
+ objectCache,
+ notificationsService,
+ http,
+ comparator,
);
}
-
service = initTestService();
describe('getFindAllHref', () => {
@@ -134,7 +150,7 @@ describe('DataService', () => {
let selfLink;
beforeEach(() => {
- operations = [{ op: 'replace', path: '/name', value: 'random string' } as Operation];
+ operations = [{ op: 'replace', path: '/metadata/dc.title', value: 'random string' } as Operation];
selfLink = 'https://rest.api/endpoint/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
spyOn(objectCache, 'addPatch');
});
@@ -153,16 +169,16 @@ describe('DataService', () => {
const name1 = 'random string';
const name2 = 'another random string';
beforeEach(() => {
- operations = [{ op: 'replace', path: '/name', value: name2 } as Operation];
+ operations = [{ op: 'replace', path: '/metadata/dc.title', value: name2 } as Operation];
selfLink = 'https://rest.api/endpoint/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
dso = new DSpaceObject();
dso.self = selfLink;
- dso.name = name1;
+ dso.metadata = [{ key: 'dc.title', value: name1 }];
dso2 = new DSpaceObject();
dso2.self = selfLink;
- dso2.name = name2;
+ dso2.metadata = [{ key: 'dc.title', value: name2 }];
spyOn(objectCache, 'getBySelfLink').and.returnValue(dso);
spyOn(objectCache, 'addPatch');
diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts
index 85d6579176..47be86c296 100644
--- a/src/app/core/data/data.service.ts
+++ b/src/app/core/data/data.service.ts
@@ -29,7 +29,6 @@ import { NormalizedObject } from '../cache/models/normalized-object.model';
import { compare, Operation } from 'fast-json-patch';
import { ObjectCacheService } from '../cache/object-cache.service';
import { DSpaceObject } from '../shared/dspace-object.model';
-import { AuthService } from '../auth/auth.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { HttpClient } from '@angular/common/http';
import {
@@ -53,7 +52,6 @@ export abstract class DataService;
@@ -155,7 +153,7 @@ export abstract class DataService parentUUID ? `${endpoint}?parent=${parentUUID}` : endpoint)
+ map((endpoint: string) => parentUUID ? `${endpoint}?parentCommunity=${parentUUID}` : endpoint)
);
const normalizedObject: TNormalized = this.dataBuildService.normalize(dso);
diff --git a/src/app/core/data/dspace-object-data.service.spec.ts b/src/app/core/data/dspace-object-data.service.spec.ts
index cdddcb7ce6..2d478b8f73 100644
--- a/src/app/core/data/dspace-object-data.service.spec.ts
+++ b/src/app/core/data/dspace-object-data.service.spec.ts
@@ -7,6 +7,9 @@ import { FindByIDRequest } from './request.models';
import { RequestService } from './request.service';
import { DSpaceObjectDataService } from './dspace-object-data.service';
import { ObjectCacheService } from '../cache/object-cache.service';
+import { NotificationsService } from '../../shared/notifications/notifications.service';
+import { HttpClient } from '@angular/common/http';
+import { DataBuildService } from '../cache/builders/data-build.service';
describe('DSpaceObjectDataService', () => {
let scheduler: TestScheduler;
@@ -40,12 +43,20 @@ describe('DSpaceObjectDataService', () => {
})
});
objectCache = {} as ObjectCacheService;
+ const notificationsService = {} as NotificationsService;
+ const http = {} as HttpClient;
+ const comparator = {} as any;
+ const dataBuildService = {} as DataBuildService;
service = new DSpaceObjectDataService(
requestService,
rdbService,
+ dataBuildService,
+ objectCache,
halService,
- objectCache
+ notificationsService,
+ http,
+ comparator
)
});
diff --git a/src/app/core/data/dspace-object-data.service.ts b/src/app/core/data/dspace-object-data.service.ts
index f1d0f21762..9a069c4d61 100644
--- a/src/app/core/data/dspace-object-data.service.ts
+++ b/src/app/core/data/dspace-object-data.service.ts
@@ -11,7 +11,6 @@ import { RemoteData } from './remote-data';
import { RequestService } from './request.service';
import { FindAllOptions } from './request.models';
import { ObjectCacheService } from '../cache/object-cache.service';
-import { AuthService } from '../auth/auth.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { HttpClient } from '@angular/common/http';
import { DataBuildService } from '../cache/builders/data-build.service';
@@ -28,7 +27,6 @@ class DataServiceImpl extends DataService
protected store: Store,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
- protected authService: AuthService,
protected notificationsService: NotificationsService,
protected http: HttpClient,
protected comparator: DSOUpdateComparator) {
@@ -55,11 +53,10 @@ export class DSpaceObjectDataService {
protected dataBuildService: DataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
- protected authService: AuthService,
protected notificationsService: NotificationsService,
protected http: HttpClient,
protected comparator: DSOUpdateComparator) {
- this.dataService = new DataServiceImpl(requestService, rdbService, dataBuildService, null, objectCache, halService, authService, notificationsService, http, comparator);
+ this.dataService = new DataServiceImpl(requestService, rdbService, dataBuildService, null, objectCache, halService, notificationsService, http, comparator);
}
findById(uuid: string): Observable> {
diff --git a/src/app/core/data/item-data.service.spec.ts b/src/app/core/data/item-data.service.spec.ts
index bb67fc8412..1be361cb9d 100644
--- a/src/app/core/data/item-data.service.spec.ts
+++ b/src/app/core/data/item-data.service.spec.ts
@@ -9,6 +9,9 @@ import { RequestService } from './request.service';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { ObjectCacheService } from '../cache/object-cache.service';
import { FindAllOptions } from './request.models';
+import { NotificationsService } from '../../shared/notifications/notifications.service';
+import { HttpClient } from '@angular/common/http';
+import { DataBuildService } from '../cache/builders/data-build.service';
describe('ItemDataService', () => {
let scheduler: TestScheduler;
@@ -34,6 +37,10 @@ describe('ItemDataService', () => {
const scopedEndpoint = `${itemBrowseEndpoint}?scope=${scopeID}`;
const serviceEndpoint = `https://rest.api/core/items`;
const browseError = new Error('getBrowseURL failed');
+ const notificationsService = {} as NotificationsService;
+ const http = {} as HttpClient;
+ const comparator = {} as any;
+ const dataBuildService = {} as DataBuildService;
function initMockBrowseService(isSuccessful: boolean) {
const obs = isSuccessful ?
@@ -48,10 +55,14 @@ describe('ItemDataService', () => {
return new ItemDataService(
requestService,
rdbService,
+ dataBuildService,
store,
bs,
+ objectCache,
halEndpointService,
- objectCache
+ notificationsService,
+ http,
+ comparator
);
}
diff --git a/src/app/core/data/item-data.service.ts b/src/app/core/data/item-data.service.ts
index 411daa9b35..2fb2c017dc 100644
--- a/src/app/core/data/item-data.service.ts
+++ b/src/app/core/data/item-data.service.ts
@@ -17,7 +17,6 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
import { FindAllOptions } from './request.models';
import { ObjectCacheService } from '../cache/object-cache.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
-import { AuthService } from '../auth/auth.service';
import { HttpClient } from '@angular/common/http';
import { DataBuildService } from '../cache/builders/data-build.service';
import { DSOUpdateComparator } from './dso-update-comparator';
@@ -34,7 +33,6 @@ export class ItemDataService extends DataService {
private bs: BrowseService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
- protected authService: AuthService,
protected notificationsService: NotificationsService,
protected http: HttpClient,
protected comparator: DSOUpdateComparator) {
diff --git a/src/app/core/integration/integration.service.spec.ts b/src/app/core/integration/integration.service.spec.ts
index 158f4b0680..152d7ab165 100644
--- a/src/app/core/integration/integration.service.spec.ts
+++ b/src/app/core/integration/integration.service.spec.ts
@@ -40,7 +40,7 @@ describe('IntegrationService', () => {
findOptions = new IntegrationSearchOptions(uuid, name, metadata);
- function initTestService(): TestService {
+ function initTestService(): TestService {
return new TestService(
requestService,
halService
diff --git a/src/app/shared/form/form.component.spec.ts b/src/app/shared/form/form.component.spec.ts
index 06676d191e..38e95b5c49 100644
--- a/src/app/shared/form/form.component.spec.ts
+++ b/src/app/shared/form/form.component.spec.ts
@@ -350,13 +350,13 @@ describe('FormComponent test suite', () => {
const control = formComp.formGroup.get(['dc_title']);
control.setValue('Test Title');
formState.testForm.valid = true;
- spyOn(formComp.submit, 'emit');
+ spyOn(formComp.submitForm, 'emit');
form.next(formState.testForm);
formFixture.detectChanges();
formComp.onSubmit();
- expect(formComp.submit.emit).toHaveBeenCalled();
+ expect(formComp.submitForm.emit).toHaveBeenCalled();
});
it('should not emit submit Event on form submit whether the form is not valid', () => {
diff --git a/src/app/shared/mocks/mock-item.ts b/src/app/shared/mocks/mock-item.ts
index f3db69a0f2..2e5c764ee2 100644
--- a/src/app/shared/mocks/mock-item.ts
+++ b/src/app/shared/mocks/mock-item.ts
@@ -51,7 +51,6 @@ export const MockItem: Item = Object.assign(new Item(), {
id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
type: 'bitstream',
- name: 'test_word.docx',
metadata: [
{
key: 'dc.title',
@@ -86,7 +85,6 @@ export const MockItem: Item = Object.assign(new Item(), {
id: '99b00f3c-1cc6-4689-8158-91965bee6b28',
uuid: '99b00f3c-1cc6-4689-8158-91965bee6b28',
type: 'bitstream',
- name: 'test_pdf.pdf',
metadata: [
{
key: 'dc.title',
@@ -102,7 +100,6 @@ export const MockItem: Item = Object.assign(new Item(), {
id: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
uuid: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
type: 'item',
- name: 'Test PowerPoint Document',
metadata: [
{
key: 'dc.creator',
diff --git a/src/app/shared/search-form/search-form.component.spec.ts b/src/app/shared/search-form/search-form.component.spec.ts
index 30f5801cc2..004d0c5b21 100644
--- a/src/app/shared/search-form/search-form.component.spec.ts
+++ b/src/app/shared/search-form/search-form.component.spec.ts
@@ -121,7 +121,6 @@ export const objects: DSpaceObject[] = [
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
type: ResourceType.Community,
- name: 'OR2017 - Demonstration',
metadata: [
{
key: 'dc.description',
@@ -171,7 +170,6 @@ export const objects: DSpaceObject[] = [
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
type: ResourceType.Community,
- name: 'Sample Community',
metadata: [
{
key: 'dc.description',
diff --git a/src/app/shared/testing/eperson-mock.ts b/src/app/shared/testing/eperson-mock.ts
index f163a490b9..ef27f4983d 100644
--- a/src/app/shared/testing/eperson-mock.ts
+++ b/src/app/shared/testing/eperson-mock.ts
@@ -13,8 +13,12 @@ export const EPersonMock: EPerson = Object.assign(new EPerson(),{
id: 'testid',
uuid: 'testid',
type: 'eperson',
- name: 'User Test',
metadata: [
+ {
+ key: 'dc.title',
+ language: null,
+ value: 'User Test'
+ },
{
key: 'eperson.firstname',
language: null,