mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
68346: Tests fixes
This commit is contained in:
@@ -41,24 +41,33 @@ describe('EditBitstreamPageComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
allFormats = [
|
allFormats = [
|
||||||
{
|
Object.assign({
|
||||||
id: '1',
|
id: '1',
|
||||||
shortDescription: 'Unknown',
|
shortDescription: 'Unknown',
|
||||||
description: 'Unknown format',
|
description: 'Unknown format',
|
||||||
supportLevel: BitstreamFormatSupportLevel.Unknown
|
supportLevel: BitstreamFormatSupportLevel.Unknown,
|
||||||
},
|
_links: {
|
||||||
{
|
self: { href: 'format-selflink-1' }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
Object.assign({
|
||||||
id: '2',
|
id: '2',
|
||||||
shortDescription: 'PNG',
|
shortDescription: 'PNG',
|
||||||
description: 'Portable Network Graphics',
|
description: 'Portable Network Graphics',
|
||||||
supportLevel: BitstreamFormatSupportLevel.Known
|
supportLevel: BitstreamFormatSupportLevel.Known,
|
||||||
},
|
_links: {
|
||||||
{
|
self: { href: 'format-selflink-2' }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
Object.assign({
|
||||||
id: '3',
|
id: '3',
|
||||||
shortDescription: 'GIF',
|
shortDescription: 'GIF',
|
||||||
description: 'Graphics Interchange Format',
|
description: 'Graphics Interchange Format',
|
||||||
supportLevel: BitstreamFormatSupportLevel.Known
|
supportLevel: BitstreamFormatSupportLevel.Known,
|
||||||
|
_links: {
|
||||||
|
self: { href: 'format-selflink-3' }
|
||||||
}
|
}
|
||||||
|
})
|
||||||
] as BitstreamFormat[];
|
] as BitstreamFormat[];
|
||||||
selectedFormat = allFormats[1];
|
selectedFormat = allFormats[1];
|
||||||
notificationsService = jasmine.createSpyObj('notificationsService',
|
notificationsService = jasmine.createSpyObj('notificationsService',
|
||||||
@@ -93,7 +102,10 @@ describe('EditBitstreamPageComponent', () => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
format: observableOf(new RemoteData(false, false, true, null, selectedFormat))
|
format: observableOf(new RemoteData(false, false, true, null, selectedFormat)),
|
||||||
|
_links: {
|
||||||
|
self: 'bitstream-selflink'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
bitstreamService = jasmine.createSpyObj('bitstreamService', {
|
bitstreamService = jasmine.createSpyObj('bitstreamService', {
|
||||||
findById: observableOf(new RemoteData(false, false, true, null, bitstream)),
|
findById: observableOf(new RemoteData(false, false, true, null, bitstream)),
|
||||||
|
@@ -31,7 +31,9 @@ describe('UploadBistreamComponent', () => {
|
|||||||
const bundle = Object.assign(new Bundle(), {
|
const bundle = Object.assign(new Bundle(), {
|
||||||
id: 'bundle',
|
id: 'bundle',
|
||||||
uuid: 'bundle',
|
uuid: 'bundle',
|
||||||
self: 'bundle-selflink'
|
_links: {
|
||||||
|
self: { href: 'bundle-selflink' }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const itemName = 'fake-name';
|
const itemName = 'fake-name';
|
||||||
const mockItem = Object.assign(new Item(), {
|
const mockItem = Object.assign(new Item(), {
|
||||||
@@ -112,7 +114,7 @@ describe('UploadBistreamComponent', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
||||||
declarations: [UploadBitstreamComponent, VarDirective],
|
declarations: [UploadBitstreamComponent, VarDirective],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: ActivatedRoute, useValue: routeStub },
|
{ provide: ActivatedRoute, useValue: routeStub },
|
||||||
|
@@ -35,9 +35,11 @@ const infoNotification: INotification = new Notification('id', NotificationType.
|
|||||||
const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning');
|
const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning');
|
||||||
const successNotification: INotification = new Notification('id', NotificationType.Success, 'success');
|
const successNotification: INotification = new Notification('id', NotificationType.Success, 'success');
|
||||||
const bitstream1 = Object.assign(new Bitstream(), {
|
const bitstream1 = Object.assign(new Bitstream(), {
|
||||||
|
id: 'bitstream1',
|
||||||
uuid: 'bitstream1'
|
uuid: 'bitstream1'
|
||||||
});
|
});
|
||||||
const bitstream2 = Object.assign(new Bitstream(), {
|
const bitstream2 = Object.assign(new Bitstream(), {
|
||||||
|
id: 'bitstream2',
|
||||||
uuid: 'bitstream2'
|
uuid: 'bitstream2'
|
||||||
});
|
});
|
||||||
const fieldUpdate1 = {
|
const fieldUpdate1 = {
|
||||||
@@ -51,7 +53,9 @@ const fieldUpdate2 = {
|
|||||||
const bundle = Object.assign(new Bundle(), {
|
const bundle = Object.assign(new Bundle(), {
|
||||||
id: 'bundle1',
|
id: 'bundle1',
|
||||||
uuid: 'bundle1',
|
uuid: 'bundle1',
|
||||||
self: 'bundle1-selflink',
|
_links: {
|
||||||
|
self: { href: 'bundle1-selflink' }
|
||||||
|
},
|
||||||
bitstreams: createMockRDPaginatedObs([bitstream1, bitstream2])
|
bitstreams: createMockRDPaginatedObs([bitstream1, bitstream2])
|
||||||
});
|
});
|
||||||
const moveOperations = [
|
const moveOperations = [
|
||||||
@@ -124,6 +128,9 @@ describe('ItemBitstreamsComponent', () => {
|
|||||||
item = Object.assign(new Item(), {
|
item = Object.assign(new Item(), {
|
||||||
uuid: 'item',
|
uuid: 'item',
|
||||||
id: 'item',
|
id: 'item',
|
||||||
|
_links: {
|
||||||
|
self: { href: 'item-selflink' }
|
||||||
|
},
|
||||||
bundles: createMockRDPaginatedObs([bundle]),
|
bundles: createMockRDPaginatedObs([bundle]),
|
||||||
lastModified: date
|
lastModified: date
|
||||||
});
|
});
|
||||||
@@ -177,11 +184,11 @@ describe('ItemBitstreamsComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should call deleteAndReturnResponse on the bitstreamService for the marked field', () => {
|
it('should call deleteAndReturnResponse on the bitstreamService for the marked field', () => {
|
||||||
expect(bitstreamService.deleteAndReturnResponse).toHaveBeenCalledWith(bitstream2);
|
expect(bitstreamService.deleteAndReturnResponse).toHaveBeenCalledWith(bitstream2.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call deleteAndReturnResponse on the bitstreamService for the unmarked field', () => {
|
it('should not call deleteAndReturnResponse on the bitstreamService for the unmarked field', () => {
|
||||||
expect(bitstreamService.deleteAndReturnResponse).not.toHaveBeenCalledWith(bitstream1);
|
expect(bitstreamService.deleteAndReturnResponse).not.toHaveBeenCalledWith(bitstream1.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should send out a patch for the move operations', () => {
|
it('should send out a patch for the move operations', () => {
|
||||||
|
@@ -26,7 +26,9 @@ describe('ItemEditBitstreamBundleComponent', () => {
|
|||||||
const bundle = Object.assign(new Bundle(), {
|
const bundle = Object.assign(new Bundle(), {
|
||||||
id: 'bundle-1',
|
id: 'bundle-1',
|
||||||
uuid: 'bundle-1',
|
uuid: 'bundle-1',
|
||||||
self: 'bundle-1-selflink'
|
_links: {
|
||||||
|
self: { href: 'bundle-1-selflink' }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
|
@@ -32,7 +32,9 @@ describe('PaginatedDragAndDropBitstreamListComponent', () => {
|
|||||||
const bundle = Object.assign(new Bundle(), {
|
const bundle = Object.assign(new Bundle(), {
|
||||||
id: 'bundle-1',
|
id: 'bundle-1',
|
||||||
uuid: 'bundle-1',
|
uuid: 'bundle-1',
|
||||||
self: 'bundle-1-selflink'
|
_links: {
|
||||||
|
self: { href: 'bundle-1-selflink' }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const format = Object.assign(new BitstreamFormat(), {
|
const format = Object.assign(new BitstreamFormat(), {
|
||||||
|
@@ -53,8 +53,11 @@ describe('ServerSyncBufferEffects', () => {
|
|||||||
return observableOf(object);
|
return observableOf(object);
|
||||||
},
|
},
|
||||||
getBySelfLink: (link) => {
|
getBySelfLink: (link) => {
|
||||||
const object = new DSpaceObject();
|
const object = Object.assign(new DSpaceObject(), {
|
||||||
object.self = link;
|
_links: {
|
||||||
|
self: { href: link }
|
||||||
|
}
|
||||||
|
});
|
||||||
return observableOf(object);
|
return observableOf(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,9 @@ describe('BitstreamDataService', () => {
|
|||||||
|
|
||||||
const bitstream = Object.assign(new Bitstream(), {
|
const bitstream = Object.assign(new Bitstream(), {
|
||||||
uuid: 'fake-bitstream',
|
uuid: 'fake-bitstream',
|
||||||
self: 'fake-bitstream-self'
|
_links: {
|
||||||
|
self: { href: 'fake-bitstream-self' }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const format = Object.assign(new BitstreamFormat(), {
|
const format = Object.assign(new BitstreamFormat(), {
|
||||||
id: '2',
|
id: '2',
|
||||||
@@ -41,7 +43,7 @@ describe('BitstreamDataService', () => {
|
|||||||
getBrowseEndpoint: observableOf(bitstreamFormatHref)
|
getBrowseEndpoint: observableOf(bitstreamFormatHref)
|
||||||
});
|
});
|
||||||
|
|
||||||
service = new BitstreamDataService(requestService, null, null, null, null, objectCache, halService, null, null, null, bitstreamFormatService);
|
service = new BitstreamDataService(requestService, null, null, null, objectCache, halService, null, null, null, null, bitstreamFormatService);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when updating the bitstream\'s format', () => {
|
describe('when updating the bitstream\'s format', () => {
|
||||||
|
@@ -17,6 +17,7 @@ import { CollectionSearchResult } from '../../../object-collection/shared/collec
|
|||||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||||
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||||
import { CollectionSearchResultGridElementComponent } from './collection-search-result-grid-element.component';
|
import { CollectionSearchResultGridElementComponent } from './collection-search-result-grid-element.component';
|
||||||
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
|
|
||||||
let collectionSearchResultGridElementComponent: CollectionSearchResultGridElementComponent;
|
let collectionSearchResultGridElementComponent: CollectionSearchResultGridElementComponent;
|
||||||
let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>;
|
let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>;
|
||||||
@@ -68,6 +69,7 @@ describe('CollectionSearchResultGridElementComponent', () => {
|
|||||||
{ provide: HttpClient, useValue: {} },
|
{ provide: HttpClient, useValue: {} },
|
||||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
|
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
@@ -17,6 +17,7 @@ import { CommunitySearchResult } from '../../../object-collection/shared/communi
|
|||||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||||
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||||
import { CommunitySearchResultGridElementComponent } from './community-search-result-grid-element.component';
|
import { CommunitySearchResultGridElementComponent } from './community-search-result-grid-element.component';
|
||||||
|
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||||
|
|
||||||
let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent;
|
let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent;
|
||||||
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
|
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
|
||||||
@@ -68,6 +69,7 @@ describe('CommunitySearchResultGridElementComponent', () => {
|
|||||||
{ provide: HttpClient, useValue: {} },
|
{ provide: HttpClient, useValue: {} },
|
||||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
|
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
Reference in New Issue
Block a user