1
0
Files
yel-dspace-angular/src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component.spec.ts
Kristof De Langhe ed3f7dfc7b Merge branch 'master' into w2p-65572_Add-support-for-bundles
Conflicts:
	src/app/core/shared/item.model.ts
	src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts
	src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts
	src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts
	src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts
	src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts
	src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts
	src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts
	src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts
	src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.spec.ts
	src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts
	src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts
	src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts
	src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts
	src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.spec.ts
	src/app/shared/testing/utils.ts
2019-11-21 14:14:39 +01:00

91 lines
3.1 KiB
TypeScript

import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { of as observableOf } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { ClaimedSearchResultListElementComponent } from './claimed-search-result-list-element.component';
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
import { ClaimedTaskSearchResult } from '../../../object-collection/shared/claimed-task-search-result.model';
import { TruncatableAction } from '../../../truncatable/truncatable.actions';
import { TruncatableService } from '../../../truncatable/truncatable.service';
let component: ClaimedSearchResultListElementComponent;
let fixture: ComponentFixture<ClaimedSearchResultListElementComponent>;
const compIndex = 1;
const mockResultObject: ClaimedTaskSearchResult = new ClaimedTaskSearchResult();
mockResultObject.hitHighlights = {};
const item = Object.assign(new Item(), {
bundles: observableOf({}),
metadata: {
'dc.title': [
{
language: 'en_US',
value: 'This is just another title'
}
],
'dc.type': [
{
language: null,
value: 'Article'
}
],
'dc.contributor.author': [
{
language: 'en_US',
value: 'Smith, Donald'
}
],
'dc.date.issued': [
{
language: null,
value: '2015-06-26'
}
]
}
});
const rdItem = createSuccessfulRemoteDataObject(item);
const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
mockResultObject.indexableObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem) });
describe('ClaimedSearchResultListElementComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NoopAnimationsModule],
declarations: [ClaimedSearchResultListElementComponent],
providers: [
{ provide: TruncatableService, useValue: {} },
],
schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(ClaimedSearchResultListElementComponent, {
set: { changeDetection: ChangeDetectionStrategy.Default }
}).compileComponents();
}));
beforeEach(async(() => {
fixture = TestBed.createComponent(ClaimedSearchResultListElementComponent);
component = fixture.componentInstance;
}));
beforeEach(() => {
component.dso = mockResultObject.indexableObject;
fixture.detectChanges();
});
it('should init item properly', () => {
expect(component.workflowitem).toEqual(workflowitem);
});
it('should have properly status', () => {
expect(component.status).toEqual(MyDspaceItemStatusType.VALIDATION);
});
});