mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
#674 fix tests
This commit is contained in:
@@ -13,6 +13,7 @@ import { Collection } from '../../../../../core/shared/collection.model';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths';
|
import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths';
|
||||||
|
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||||
|
|
||||||
describe('CollectionAdminSearchResultGridElementComponent', () => {
|
describe('CollectionAdminSearchResultGridElementComponent', () => {
|
||||||
let component: CollectionAdminSearchResultGridElementComponent;
|
let component: CollectionAdminSearchResultGridElementComponent;
|
||||||
@@ -26,6 +27,11 @@ describe('CollectionAdminSearchResultGridElementComponent', () => {
|
|||||||
searchResult.indexableObject = new Collection();
|
searchResult.indexableObject = new Collection();
|
||||||
searchResult.indexableObject.uuid = id;
|
searchResult.indexableObject.uuid = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const linkService = jasmine.createSpyObj('linkService', {
|
||||||
|
resolveLink: {}
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
init();
|
init();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -39,6 +45,7 @@ describe('CollectionAdminSearchResultGridElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||||
{ provide: BitstreamDataService, useValue: {} },
|
{ provide: BitstreamDataService, useValue: {} },
|
||||||
|
{ provide: LinkService, useValue: linkService}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
@@ -16,6 +16,7 @@ import { CommunitySearchResult } from '../../../../../shared/object-collection/s
|
|||||||
import { Community } from '../../../../../core/shared/community.model';
|
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 { 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 { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths';
|
||||||
|
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||||
|
|
||||||
describe('CommunityAdminSearchResultGridElementComponent', () => {
|
describe('CommunityAdminSearchResultGridElementComponent', () => {
|
||||||
let component: CommunityAdminSearchResultGridElementComponent;
|
let component: CommunityAdminSearchResultGridElementComponent;
|
||||||
@@ -29,6 +30,11 @@ describe('CommunityAdminSearchResultGridElementComponent', () => {
|
|||||||
searchResult.indexableObject = new Community();
|
searchResult.indexableObject = new Community();
|
||||||
searchResult.indexableObject.uuid = id;
|
searchResult.indexableObject.uuid = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const linkService = jasmine.createSpyObj('linkService', {
|
||||||
|
resolveLink: {}
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
init();
|
init();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -42,6 +48,7 @@ describe('CommunityAdminSearchResultGridElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||||
{ provide: BitstreamDataService, useValue: {} },
|
{ provide: BitstreamDataService, useValue: {} },
|
||||||
|
{ provide: LinkService, useValue: linkService}
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
|
@@ -3,10 +3,16 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Collection } from '../../../core/shared/collection.model';
|
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 collectionGridElementComponent: CollectionGridElementComponent;
|
||||||
let fixture: ComponentFixture<CollectionGridElementComponent>;
|
let fixture: ComponentFixture<CollectionGridElementComponent>;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
||||||
metadata: {
|
metadata: {
|
||||||
'dc.description.abstract': [
|
'dc.description.abstract': [
|
||||||
@@ -29,12 +35,17 @@ const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const linkService = jasmine.createSpyObj('linkService', {
|
||||||
|
resolveLink: mockCollectionWithAbstract
|
||||||
|
});
|
||||||
|
|
||||||
describe('CollectionGridElementComponent', () => {
|
describe('CollectionGridElementComponent', () => {
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ CollectionGridElementComponent ],
|
declarations: [ CollectionGridElementComponent ],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)}
|
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)},
|
||||||
|
{ provide: LinkService, useValue: linkService}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
@@ -3,6 +3,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Community } from '../../../core/shared/community.model';
|
import { Community } from '../../../core/shared/community.model';
|
||||||
|
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||||
|
|
||||||
let communityGridElementComponent: CommunityGridElementComponent;
|
let communityGridElementComponent: CommunityGridElementComponent;
|
||||||
let fixture: ComponentFixture<CommunityGridElementComponent>;
|
let fixture: ComponentFixture<CommunityGridElementComponent>;
|
||||||
@@ -29,12 +30,17 @@ const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const linkService = jasmine.createSpyObj('linkService', {
|
||||||
|
resolveLink: mockCommunityWithAbstract
|
||||||
|
});
|
||||||
|
|
||||||
describe('CommunityGridElementComponent', () => {
|
describe('CommunityGridElementComponent', () => {
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ CommunityGridElementComponent ],
|
declarations: [ CommunityGridElementComponent ],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)}
|
{ provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)},
|
||||||
|
{ provide: LinkService, useValue: linkService}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
@@ -19,6 +19,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service';
|
|||||||
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||||
import { CollectionSearchResultGridElementComponent } from './collection-search-result-grid-element.component';
|
import { CollectionSearchResultGridElementComponent } from './collection-search-result-grid-element.component';
|
||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
|
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||||
|
|
||||||
let collectionSearchResultGridElementComponent: CollectionSearchResultGridElementComponent;
|
let collectionSearchResultGridElementComponent: CollectionSearchResultGridElementComponent;
|
||||||
let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>;
|
let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>;
|
||||||
@@ -52,6 +53,9 @@ mockCollectionWithoutAbstract.indexableObject = Object.assign(new Collection(),
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const linkService = jasmine.createSpyObj('linkService', {
|
||||||
|
resolveLink: mockCollectionWithAbstract
|
||||||
|
});
|
||||||
|
|
||||||
describe('CollectionSearchResultGridElementComponent', () => {
|
describe('CollectionSearchResultGridElementComponent', () => {
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
@@ -72,6 +76,7 @@ describe('CollectionSearchResultGridElementComponent', () => {
|
|||||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
{ provide: BitstreamFormatDataService, useValue: {} },
|
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||||
|
{ provide: LinkService, useValue: linkService}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
@@ -33,7 +33,6 @@ export class CollectionSearchResultGridElementComponent extends SearchResultGrid
|
|||||||
|
|
||||||
@Input() set dso(dso: Collection) {
|
@Input() set dso(dso: Collection) {
|
||||||
this._dso = dso;
|
this._dso = dso;
|
||||||
console.log('aaasdasd')
|
|
||||||
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
|
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
|
||||||
this.linkService.resolveLink<Collection>(
|
this.linkService.resolveLink<Collection>(
|
||||||
this._dso,
|
this._dso,
|
||||||
|
@@ -19,6 +19,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service';
|
|||||||
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||||
import { CommunitySearchResultGridElementComponent } from './community-search-result-grid-element.component';
|
import { CommunitySearchResultGridElementComponent } from './community-search-result-grid-element.component';
|
||||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
|
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||||
|
|
||||||
let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent;
|
let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent;
|
||||||
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
|
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
|
||||||
@@ -52,6 +53,9 @@ mockCommunityWithoutAbstract.indexableObject = Object.assign(new Community(), {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const linkService = jasmine.createSpyObj('linkService', {
|
||||||
|
resolveLink: mockCommunityWithAbstract
|
||||||
|
});
|
||||||
|
|
||||||
describe('CommunitySearchResultGridElementComponent', () => {
|
describe('CommunitySearchResultGridElementComponent', () => {
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
@@ -72,6 +76,7 @@ describe('CommunitySearchResultGridElementComponent', () => {
|
|||||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
{ provide: BitstreamFormatDataService, useValue: {} },
|
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||||
|
{ provide: LinkService, useValue: linkService}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
@@ -35,7 +35,6 @@ export class CommunitySearchResultGridElementComponent extends SearchResultGridE
|
|||||||
|
|
||||||
@Input() set dso(dso: Community) {
|
@Input() set dso(dso: Community) {
|
||||||
this._dso = dso;
|
this._dso = dso;
|
||||||
console.log('aaasdasd');
|
|
||||||
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
|
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
|
||||||
this.linkService.resolveLink<Community>(this._dso, followLink('logo'));
|
this.linkService.resolveLink<Community>(this._dso, followLink('logo'));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user