diff --git a/src/app/core/shared/collection.model.spec.ts b/src/app/core/shared/collection.model.spec.ts index 82e90f05cd..b35fa7415b 100644 --- a/src/app/core/shared/collection.model.spec.ts +++ b/src/app/core/shared/collection.model.spec.ts @@ -5,11 +5,9 @@ describe('Collection', () => { describe('Collection handle value', () => { let metadataValue; - let handleValue; beforeEach(() => { metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; - handleValue = '11111111111/1'; }) it('should return the handle value from metadata', () => { @@ -17,13 +15,8 @@ describe('Collection', () => { expect(community.handle).toEqual('123456789/1'); }); - it('should return the handle value from metadata even when the handle field is provided', () => { - const community = Object.assign(new Collection(), { handle: handleValue, metadata: metadataValue }); - expect(community.handle).toEqual('123456789/1'); - }); - it('should return undefined if the handle value from metadata is not present', () => { - const community = Object.assign(new Collection(), { handle: handleValue }); + const community = Object.assign(new Collection(), { }); expect(community.handle).toEqual(undefined); }); }); diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts index d0033ee7ca..a82f0646c5 100644 --- a/src/app/core/shared/collection.model.ts +++ b/src/app/core/shared/collection.model.ts @@ -1,4 +1,4 @@ -import { deserialize, deserializeAs, inheritSerialization } from 'cerialize'; +import { deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; @@ -15,17 +15,12 @@ import { RESOURCE_POLICY } from '../resource-policy/models/resource-policy.resou import { COMMUNITY } from './community.resource-type'; import { Community } from './community.model'; import { ChildHALResource } from './child-hal-resource.model'; -import { excludeFromEquals } from '../utilities/equals.decorators'; @typedObject @inheritSerialization(DSpaceObject) export class Collection extends DSpaceObject implements ChildHALResource { static type = COLLECTION; - @excludeFromEquals - @deserializeAs('handle') - private _handle: string; - /** * The {@link HALLink}s for this Collection */ @@ -81,10 +76,6 @@ export class Collection extends DSpaceObject implements ChildHALResource { return this.firstMetadataValue('dc.identifier.uri'); } - set handle(value: string) { - this._handle = value; - } - /** * The introductory text of this Collection * Corresponds to the metadata field dc.description diff --git a/src/app/core/shared/community.model.spec.ts b/src/app/core/shared/community.model.spec.ts index 1b688c9df9..5697686853 100644 --- a/src/app/core/shared/community.model.spec.ts +++ b/src/app/core/shared/community.model.spec.ts @@ -5,11 +5,9 @@ describe('Community', () => { describe('Community handle value', () => { let metadataValue; - let handleValue; beforeEach(() => { metadataValue = {'dc.identifier.uri': [ { value: '123456789/1'}]}; - handleValue = '11111111111/1'; }) it('should return the handle value from metadata', () => { @@ -17,13 +15,8 @@ describe('Community', () => { expect(community.handle).toEqual('123456789/1'); }); - it('should return the handle value from metadata even when the handle field is provided', () => { - const community = Object.assign(new Community(), { handle: handleValue, metadata: metadataValue }); - expect(community.handle).toEqual('123456789/1'); - }); - it('should return undefined if the handle value from metadata is not present', () => { - const community = Object.assign(new Community(), { handle: handleValue }); + const community = Object.assign(new Community(), { }); expect(community.handle).toEqual(undefined); }); }); diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts index 1f76cb66de..778696486b 100644 --- a/src/app/core/shared/community.model.ts +++ b/src/app/core/shared/community.model.ts @@ -1,4 +1,4 @@ -import { deserialize, deserializeAs, inheritSerialization } from 'cerialize'; +import { deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; @@ -11,17 +11,12 @@ import { COMMUNITY } from './community.resource-type'; import { DSpaceObject } from './dspace-object.model'; import { HALLink } from './hal-link.model'; import { ChildHALResource } from './child-hal-resource.model'; -import { excludeFromEquals } from '../utilities/equals.decorators'; @typedObject @inheritSerialization(DSpaceObject) export class Community extends DSpaceObject implements ChildHALResource { static type = COMMUNITY; - @excludeFromEquals - @deserializeAs('handle') - private _handle: string; - /** * The {@link HALLink}s for this Community */ @@ -70,10 +65,6 @@ export class Community extends DSpaceObject implements ChildHALResource { return this.firstMetadataValue('dc.identifier.uri'); } - set handle(value: string) { - this._handle = value; - } - /** * The introductory text of this Community * Corresponds to the metadata field dc.description diff --git a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts index 0fb1b458e1..e3e0c65920 100644 --- a/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts +++ b/src/app/shared/comcol-page-handle/comcol-page-handle.component.spec.ts @@ -5,7 +5,7 @@ import { ComcolPageHandleComponent } from './comcol-page-handle.component'; const handle = 'http://localhost:4000/handle/123456789/2'; -fdescribe('ComcolPageHandleComponent', () => { +describe('ComcolPageHandleComponent', () => { let component: ComcolPageHandleComponent; let fixture: ComponentFixture; diff --git a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts index 40aab2fad5..ef9abbb5ee 100644 --- a/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts +++ b/src/app/shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component.spec.ts @@ -53,12 +53,26 @@ describe('ExportMetadataSelectorComponent', () => { const mockCollection: Collection = Object.assign(new Collection(), { id: 'test-collection-1-1', name: 'test-collection-1', - handle: 'fake/test-collection-1', + metadata: { + 'dc.identifier.uri': [ + { + language: null, + value: 'fake/test-collection-1' + } + ] + } }); const mockCommunity = Object.assign(new Community(), { id: 'test-uuid', - handle: 'fake/test-community-1', + metadata: { + 'dc.identifier.uri': [ + { + language: null, + value: 'fake/test-community-1' + } + ] + } }); const itemRD = createSuccessfulRemoteDataObject(mockItem); 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 ffd8dd87a2..45339d98d2 100644 --- a/src/app/shared/search-form/search-form.component.spec.ts +++ b/src/app/shared/search-form/search-form.component.spec.ts @@ -109,7 +109,6 @@ describe('SearchFormComponent', () => { export const objects: DSpaceObject[] = [ Object.assign(new Community(), { - handle: '10673/11', logo: { self: { _isScalar: true, @@ -162,12 +161,17 @@ export const objects: DSpaceObject[] = [ language: null, value: 'OR2017 - Demonstration' } - ] + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/11' + } + ], } }), Object.assign(new Community(), { - handle: '10673/1', logo: { self: { _isScalar: true, @@ -220,7 +224,13 @@ export const objects: DSpaceObject[] = [ language: null, value: 'Sample Community' } - ] + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/1' + } + ], } } ) diff --git a/src/app/shared/search/search-results/search-results.component.spec.ts b/src/app/shared/search/search-results/search-results.component.spec.ts index b4586129e2..0386787654 100644 --- a/src/app/shared/search/search-results/search-results.component.spec.ts +++ b/src/app/shared/search/search-results/search-results.component.spec.ts @@ -96,7 +96,6 @@ describe('SearchResultsComponent', () => { export const objects = [ Object.assign(new Community(), { - handle: '10673/11', logo: { self: { _isScalar: true, @@ -149,12 +148,17 @@ export const objects = [ language: null, value: 'OR2017 - Demonstration' } + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/11' + } ] } }), Object.assign(new Community(), { - handle: '10673/1', logo: { self: { _isScalar: true, @@ -207,6 +211,12 @@ export const objects = [ language: null, value: 'Sample Community' } + ], + 'dc.identifier.uri': [ + { + language: null, + value: 'http://localhost:4000/handle/10673/1' + } ] } }