mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fixed merge issue
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { waitForAsync, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
import { ComponentFixture, fakeAsync, flush, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
@@ -18,6 +18,8 @@ import { getMockLinkService } from '../../../mocks/link-service.mock';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||||
|
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||||
|
|
||||||
let component: PoolSearchResultListElementComponent;
|
let component: PoolSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<PoolSearchResultListElementComponent>;
|
let fixture: ComponentFixture<PoolSearchResultListElementComponent>;
|
||||||
@@ -54,11 +56,21 @@ const item = Object.assign(new Item(), {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const rdItem = createSuccessfulRemoteDataObject(item);
|
const rdItem = createSuccessfulRemoteDataObject(item);
|
||||||
const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
|
const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
|
||||||
const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
|
const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
|
||||||
mockResultObject.indexableObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) });
|
mockResultObject.indexableObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem) });
|
||||||
const linkService = getMockLinkService();
|
const linkService = getMockLinkService();
|
||||||
|
const objectCacheServiceMock = jasmine.createSpyObj('ObjectCacheService', {
|
||||||
|
remove: jasmine.createSpy('remove')
|
||||||
|
});
|
||||||
|
|
||||||
describe('PoolSearchResultListElementComponent', () => {
|
describe('PoolSearchResultListElementComponent', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
@@ -68,7 +80,9 @@ describe('PoolSearchResultListElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: LinkService, useValue: linkService },
|
{ provide: LinkService, useValue: linkService },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs },
|
||||||
|
{ provide: ObjectCacheService, useValue: objectCacheServiceMock }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(PoolSearchResultListElementComponent, {
|
}).overrideComponent(PoolSearchResultListElementComponent, {
|
||||||
@@ -86,17 +100,16 @@ describe('PoolSearchResultListElementComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should init workflowitem properly', (done) => {
|
it('should init workflowitem properly', fakeAsync(() => {
|
||||||
component.workflowitemRD$.subscribe((workflowitemRD) => {
|
flush();
|
||||||
expect(linkService.resolveLinks).toHaveBeenCalledWith(
|
expect(linkService.resolveLinks).toHaveBeenCalledWith(
|
||||||
component.dso,
|
component.dso,
|
||||||
jasmine.objectContaining({ name: 'workflowitem' }),
|
jasmine.objectContaining({ name: 'workflowitem' }),
|
||||||
jasmine.objectContaining({ name: 'action' })
|
jasmine.objectContaining({ name: 'action' })
|
||||||
);
|
);
|
||||||
expect(workflowitemRD.payload).toEqual(workflowitem);
|
expect(component.workflowitem$.value).toEqual(workflowitem);
|
||||||
done();
|
expect(component.item$.value).toEqual(item);
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
|
|
||||||
it('should have properly status', () => {
|
it('should have properly status', () => {
|
||||||
expect(component.status).toEqual(MyDspaceItemStatusType.WAITING_CONTROLLER);
|
expect(component.status).toEqual(MyDspaceItemStatusType.WAITING_CONTROLLER);
|
||||||
@@ -112,4 +125,9 @@ describe('PoolSearchResultListElementComponent', () => {
|
|||||||
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should add an offset to the actions element', () => {
|
||||||
|
const thumbnail = fixture.debugElement.query(By.css('.offset-3'));
|
||||||
|
expect(thumbnail).toBeTruthy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user