diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts index 34db71db77..8ca02fa8ad 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts @@ -13,6 +13,7 @@ import { Collection } from '../../../../../core/shared/collection.model'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths'; +import { LinkService } from '../../../../../core/cache/builders/link.service'; describe('CollectionAdminSearchResultGridElementComponent', () => { let component: CollectionAdminSearchResultGridElementComponent; @@ -26,6 +27,11 @@ describe('CollectionAdminSearchResultGridElementComponent', () => { searchResult.indexableObject = new Collection(); searchResult.indexableObject.uuid = id; } + + const linkService = jasmine.createSpyObj('linkService', { + resolveLink: {} + }); + beforeEach(async(() => { init(); TestBed.configureTestingModule({ @@ -39,6 +45,7 @@ describe('CollectionAdminSearchResultGridElementComponent', () => { providers: [ { provide: TruncatableService, useValue: mockTruncatableService }, { provide: BitstreamDataService, useValue: {} }, + { provide: LinkService, useValue: linkService} ] }) .compileComponents(); diff --git a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts index 85c81d55a4..f6a4d02c13 100644 --- a/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts +++ b/src/app/+admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts @@ -16,6 +16,7 @@ import { CommunitySearchResult } from '../../../../../shared/object-collection/s import { Community } from '../../../../../core/shared/community.model'; import { CommunityAdminSearchResultListElementComponent } from '../../admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component'; import { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths'; +import { LinkService } from '../../../../../core/cache/builders/link.service'; describe('CommunityAdminSearchResultGridElementComponent', () => { let component: CommunityAdminSearchResultGridElementComponent; @@ -29,6 +30,11 @@ describe('CommunityAdminSearchResultGridElementComponent', () => { searchResult.indexableObject = new Community(); searchResult.indexableObject.uuid = id; } + + const linkService = jasmine.createSpyObj('linkService', { + resolveLink: {} + }); + beforeEach(async(() => { init(); TestBed.configureTestingModule({ @@ -42,6 +48,7 @@ describe('CommunityAdminSearchResultGridElementComponent', () => { providers: [ { provide: TruncatableService, useValue: mockTruncatableService }, { provide: BitstreamDataService, useValue: {} }, + { provide: LinkService, useValue: linkService} ], schemas: [NO_ERRORS_SCHEMA] }) diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts index 66807c6b20..9101561a51 100644 --- a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts @@ -3,10 +3,16 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { Collection } from '../../../core/shared/collection.model'; +import { of } from 'rxjs'; +import { createSuccessfulRemoteDataObject$ } from '../../remote-data.utils'; +import { Bitstream } from '../../../core/shared/bitstream.model'; +import { LinkService } from '../../../core/cache/builders/link.service'; let collectionGridElementComponent: CollectionGridElementComponent; let fixture: ComponentFixture; + + const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), { metadata: { 'dc.description.abstract': [ @@ -29,12 +35,17 @@ const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection() } }); +const linkService = jasmine.createSpyObj('linkService', { + resolveLink: mockCollectionWithAbstract +}); + describe('CollectionGridElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ CollectionGridElementComponent ], providers: [ - { provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)} + { provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)}, + { provide: LinkService, useValue: linkService} ], schemas: [ NO_ERRORS_SCHEMA ] diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts index bb6c81144a..dfcac7dc1f 100644 --- a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts @@ -3,6 +3,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { Community } from '../../../core/shared/community.model'; +import { LinkService } from '../../../core/cache/builders/link.service'; let communityGridElementComponent: CommunityGridElementComponent; let fixture: ComponentFixture; @@ -29,12 +30,17 @@ const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), { } }); +const linkService = jasmine.createSpyObj('linkService', { + resolveLink: mockCommunityWithAbstract +}); + describe('CommunityGridElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ CommunityGridElementComponent ], providers: [ - { provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)} + { provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)}, + { provide: LinkService, useValue: linkService} ], schemas: [ NO_ERRORS_SCHEMA ] diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts index d065f9c7e4..d40b99316a 100644 --- a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts @@ -19,6 +19,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatePipe } from '../../../utils/truncate.pipe'; import { CollectionSearchResultGridElementComponent } from './collection-search-result-grid-element.component'; import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; +import { LinkService } from '../../../../core/cache/builders/link.service'; let collectionSearchResultGridElementComponent: CollectionSearchResultGridElementComponent; let fixture: ComponentFixture; @@ -52,6 +53,9 @@ mockCollectionWithoutAbstract.indexableObject = Object.assign(new Collection(), ] } }); +const linkService = jasmine.createSpyObj('linkService', { + resolveLink: mockCollectionWithAbstract +}); describe('CollectionSearchResultGridElementComponent', () => { beforeEach(async(() => { @@ -72,6 +76,7 @@ describe('CollectionSearchResultGridElementComponent', () => { { provide: DSOChangeAnalyzer, useValue: {} }, { provide: DefaultChangeAnalyzer, useValue: {} }, { provide: BitstreamFormatDataService, useValue: {} }, + { provide: LinkService, useValue: linkService} ], schemas: [ NO_ERRORS_SCHEMA ] diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts index cf5a93aa56..e0182c3fb4 100644 --- a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.ts @@ -33,7 +33,6 @@ export class CollectionSearchResultGridElementComponent extends SearchResultGrid @Input() set dso(dso: Collection) { this._dso = dso; - console.log('aaasdasd') if (hasValue(this._dso) && hasNoValue(this._dso.logo)) { this.linkService.resolveLink( this._dso, diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts index 0d59273111..7b3fe0a7dc 100644 --- a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts @@ -19,6 +19,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatePipe } from '../../../utils/truncate.pipe'; import { CommunitySearchResultGridElementComponent } from './community-search-result-grid-element.component'; import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; +import { LinkService } from '../../../../core/cache/builders/link.service'; let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent; let fixture: ComponentFixture; @@ -52,6 +53,9 @@ mockCommunityWithoutAbstract.indexableObject = Object.assign(new Community(), { ] } }); +const linkService = jasmine.createSpyObj('linkService', { + resolveLink: mockCommunityWithAbstract +}); describe('CommunitySearchResultGridElementComponent', () => { beforeEach(async(() => { @@ -72,6 +76,7 @@ describe('CommunitySearchResultGridElementComponent', () => { { provide: DSOChangeAnalyzer, useValue: {} }, { provide: DefaultChangeAnalyzer, useValue: {} }, { provide: BitstreamFormatDataService, useValue: {} }, + { provide: LinkService, useValue: linkService} ], schemas: [ NO_ERRORS_SCHEMA ] diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts index b622651e10..5c4deb1064 100644 --- a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.ts @@ -35,7 +35,6 @@ export class CommunitySearchResultGridElementComponent extends SearchResultGridE @Input() set dso(dso: Community) { this._dso = dso; - console.log('aaasdasd'); if (hasValue(this._dso) && hasNoValue(this._dso.logo)) { this.linkService.resolveLink(this._dso, followLink('logo')); }