mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 12:33:07 +00:00
52 lines
2.2 KiB
TypeScript
52 lines
2.2 KiB
TypeScript
import { EditItemTemplatePageComponent } from './edit-item-template-page.component';
|
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
import { TranslateModule } from '@ngx-translate/core';
|
|
import { SharedModule } from '../../shared/shared.module';
|
|
import { RouterTestingModule } from '@angular/router/testing';
|
|
import { CommonModule } from '@angular/common';
|
|
import { ItemTemplateDataService } from '../../core/data/item-template-data.service';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
|
import { Collection } from '../../core/shared/collection.model';
|
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
import { getCollectionEditPath } from '../collection-page-routing.module';
|
|
import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils';
|
|
|
|
describe('EditItemTemplatePageComponent', () => {
|
|
let comp: EditItemTemplatePageComponent;
|
|
let fixture: ComponentFixture<EditItemTemplatePageComponent>;
|
|
let itemTemplateService: ItemTemplateDataService;
|
|
let collection: Collection;
|
|
|
|
beforeEach(async(() => {
|
|
collection = Object.assign(new Collection(), {
|
|
uuid: 'collection-id',
|
|
id: 'collection-id',
|
|
name: 'Fake Collection'
|
|
});
|
|
TestBed.configureTestingModule({
|
|
imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule],
|
|
declarations: [EditItemTemplatePageComponent],
|
|
providers: [
|
|
{ provide: ItemTemplateDataService, useValue: {} },
|
|
{ provide: ActivatedRoute, useValue: { parent: { data: observableOf({ dso: createSuccessfulRemoteDataObject(collection) }) } } }
|
|
],
|
|
schemas: [NO_ERRORS_SCHEMA]
|
|
}).compileComponents();
|
|
}));
|
|
|
|
beforeEach(() => {
|
|
fixture = TestBed.createComponent(EditItemTemplatePageComponent);
|
|
comp = fixture.componentInstance;
|
|
itemTemplateService = (comp as any).itemTemplateService;
|
|
fixture.detectChanges();
|
|
});
|
|
|
|
describe('getCollectionEditUrl', () => {
|
|
it('should return the collection\'s edit url', () => {
|
|
const url = comp.getCollectionEditUrl(collection);
|
|
expect(url).toEqual(getCollectionEditPath(collection.uuid));
|
|
});
|
|
});
|
|
});
|