fix tests

This commit is contained in:
Art Lowel
2020-04-29 14:12:45 +02:00
parent c87d0895b0
commit 2a6e0c796a
5 changed files with 10 additions and 10 deletions

View File

@@ -209,7 +209,7 @@ describe('BitstreamFormatsComponent', () => {
selectBitstreamFormat: {},
deselectBitstreamFormat: {},
deselectAllBitstreamFormats: {},
delete: observableOf(true),
delete: observableOf({ isSuccessful: true }),
clearBitStreamFormatRequests: observableOf('cleared')
});

View File

@@ -115,7 +115,7 @@ describe('ItemBitstreamsComponent', () => {
}
);
bitstreamService = jasmine.createSpyObj('bitstreamService', {
deleteAndReturnResponse: jasmine.createSpy('deleteAndReturnResponse')
delete: jasmine.createSpy('delete')
});
objectCache = jasmine.createSpyObj('objectCache', {
remove: jasmine.createSpy('remove')
@@ -183,12 +183,12 @@ describe('ItemBitstreamsComponent', () => {
comp.submit();
});
it('should call deleteAndReturnResponse on the bitstreamService for the marked field', () => {
expect(bitstreamService.deleteAndReturnResponse).toHaveBeenCalledWith(bitstream2.id);
it('should call delete on the bitstreamService for the marked field', () => {
expect(bitstreamService.delete).toHaveBeenCalledWith(bitstream2.id);
});
it('should not call deleteAndReturnResponse on the bitstreamService for the unmarked field', () => {
expect(bitstreamService.deleteAndReturnResponse).not.toHaveBeenCalledWith(bitstream1.id);
it('should not call delete on the bitstreamService for the unmarked field', () => {
expect(bitstreamService.delete).not.toHaveBeenCalledWith(bitstream1.id);
});
it('should send out a patch for the move operations', () => {

View File

@@ -281,7 +281,7 @@ describe('BitstreamFormatDataService', () => {
format.uuid = 'format-uuid';
format.id = 'format-id';
const expected = cold('(b|)', {b: true});
const expected = cold('(b|)', { b: responseCacheEntry.response });
const result = service.delete(format.id);
expect(result).toBeObservable(expected);

View File

@@ -48,7 +48,7 @@ describe('DeleteComColPageComponent', () => {
dsoDataService = jasmine.createSpyObj(
'dsoDataService',
{
delete: observableOf(true)
delete: observableOf({ isSuccessful: true })
});
routerStub = {
@@ -106,7 +106,7 @@ describe('DeleteComColPageComponent', () => {
});
it('should show an error notification on failure', () => {
(dsoDataService.delete as any).and.returnValue(observableOf(false));
(dsoDataService.delete as any).and.returnValue(observableOf({ isSuccessful: false }));
spyOn(router, 'navigate');
comp.onConfirm(data2);
fixture.detectChanges();

View File

@@ -148,7 +148,7 @@ describe('WorkspaceitemActionsComponent', () => {
it('should display a success notification on delete success', async(() => {
spyOn((component as any).modalService, 'open').and.returnValue({result: Promise.resolve('ok')});
mockDataService.delete.and.returnValue(observableOf(true));
mockDataService.delete.and.returnValue(observableOf({ isSuccessful: true }));
spyOn(component, 'reload');
component.confirmDiscard('ok');