mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
93963: Fixed tests in main
This commit is contained in:
@@ -6,6 +6,8 @@ import { By } from '@angular/platform-browser';
|
||||
import { MetadataUriValuesComponent } from './metadata-uri-values.component';
|
||||
import { isNotEmpty } from '../../../shared/empty.util';
|
||||
import { MetadataValue } from '../../../core/shared/metadata.models';
|
||||
import { APP_CONFIG } from '../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
|
||||
let comp: MetadataUriValuesComponent;
|
||||
let fixture: ComponentFixture<MetadataUriValuesComponent>;
|
||||
@@ -33,6 +35,9 @@ describe('MetadataUriValuesComponent', () => {
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
})],
|
||||
providers: [
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
],
|
||||
declarations: [MetadataUriValuesComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(MetadataUriValuesComponent, {
|
||||
|
@@ -5,6 +5,8 @@ import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock
|
||||
import { MetadataValuesComponent } from './metadata-values.component';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MetadataValue } from '../../../core/shared/metadata.models';
|
||||
import { APP_CONFIG } from '../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
|
||||
let comp: MetadataValuesComponent;
|
||||
let fixture: ComponentFixture<MetadataValuesComponent>;
|
||||
@@ -32,8 +34,11 @@ describe('MetadataValuesComponent', () => {
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
},
|
||||
})],
|
||||
providers: [
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
],
|
||||
declarations: [MetadataValuesComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(MetadataValuesComponent, {
|
||||
|
@@ -3,18 +3,14 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { ItemPageAbstractFieldComponent } from './item-page-abstract-field.component';
|
||||
import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock';
|
||||
import { MetadataValuesComponent } from '../../../../field-components/metadata-values/metadata-values.component';
|
||||
import { mockItemWithMetadataFieldAndValue } from '../item-page-field.component.spec';
|
||||
import { SharedModule } from '../../../../../shared/shared.module';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../../environments/environment';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
let comp: ItemPageAbstractFieldComponent;
|
||||
let fixture: ComponentFixture<ItemPageAbstractFieldComponent>;
|
||||
|
||||
const mockField = 'dc.description.abstract';
|
||||
const mockValue = 'test value';
|
||||
|
||||
describe('ItemPageAbstractFieldComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -30,7 +26,7 @@ describe('ItemPageAbstractFieldComponent', () => {
|
||||
providers: [
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
],
|
||||
declarations: [ItemPageAbstractFieldComponent, MetadataValuesComponent],
|
||||
declarations: [ItemPageAbstractFieldComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ItemPageAbstractFieldComponent, {
|
||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||
@@ -38,13 +34,13 @@ describe('ItemPageAbstractFieldComponent', () => {
|
||||
}));
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
|
||||
fixture = TestBed.createComponent(ItemPageAbstractFieldComponent);
|
||||
comp = fixture.componentInstance;
|
||||
comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue);
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should display display the correct metadata value', () => {
|
||||
expect(fixture.nativeElement.innerHTML).toContain(mockValue);
|
||||
it('should render a ds-metadata-values', () => {
|
||||
expect(fixture.debugElement.query(By.css('ds-metadata-values'))).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user