mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00

# Conflicts: # src/app/shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component.ts # src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.html # src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.ts # src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.ts # src/app/shared/shared.module.ts # src/app/shared/theme-support/themed.component.ts # src/themes/custom/lazy-theme.module.ts
63 lines
2.3 KiB
TypeScript
63 lines
2.3 KiB
TypeScript
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
import { BrowseLinkMetadataListElementComponent } from './browse-link-metadata-list-element.component';
|
|
import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
|
|
|
|
const mockMetadataRepresentation = Object.assign(new MetadatumRepresentation('type'), {
|
|
key: 'dc.contributor.author',
|
|
value: 'Test Author'
|
|
});
|
|
|
|
const mockMetadataRepresentationWithUrl = Object.assign(new MetadatumRepresentation('type'), {
|
|
key: 'dc.subject',
|
|
value: 'http://purl.org/test/subject'
|
|
});
|
|
|
|
describe('BrowseLinkMetadataListElementComponent', () => {
|
|
let comp: BrowseLinkMetadataListElementComponent;
|
|
let fixture: ComponentFixture<BrowseLinkMetadataListElementComponent>;
|
|
|
|
beforeEach(waitForAsync(() => {
|
|
TestBed.configureTestingModule({
|
|
imports: [],
|
|
declarations: [BrowseLinkMetadataListElementComponent],
|
|
schemas: [NO_ERRORS_SCHEMA]
|
|
}).overrideComponent(BrowseLinkMetadataListElementComponent, {
|
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
|
}).compileComponents();
|
|
}));
|
|
|
|
beforeEach(waitForAsync(() => {
|
|
fixture = TestBed.createComponent(BrowseLinkMetadataListElementComponent);
|
|
comp = fixture.componentInstance;
|
|
comp.mdRepresentation = mockMetadataRepresentation;
|
|
fixture.detectChanges();
|
|
}));
|
|
|
|
waitForAsync(() => {
|
|
it('should contain the value as a browse link', () => {
|
|
expect(fixture.debugElement.nativeElement.textContent).toContain(mockMetadataRepresentation.value);
|
|
});
|
|
it('should NOT match isLink', () => {
|
|
expect(comp.isLink).toBe(false);
|
|
});
|
|
});
|
|
|
|
beforeEach(waitForAsync(() => {
|
|
fixture = TestBed.createComponent(BrowseLinkMetadataListElementComponent);
|
|
comp = fixture.componentInstance;
|
|
comp.mdRepresentation = mockMetadataRepresentationWithUrl;
|
|
fixture.detectChanges();
|
|
}));
|
|
|
|
waitForAsync(() => {
|
|
it('should contain the value expected', () => {
|
|
expect(fixture.debugElement.nativeElement.textContent).toContain(mockMetadataRepresentationWithUrl.value);
|
|
});
|
|
it('should match isLink', () => {
|
|
expect(comp.isLink).toBe(true);
|
|
});
|
|
});
|
|
|
|
});
|