Fixed build error

This commit is contained in:
Giuseppe Digilio
2019-01-17 11:53:00 +01:00
parent e6ec979d44
commit d76376ef92
13 changed files with 113 additions and 107 deletions

View File

@@ -46,7 +46,7 @@ describe('ItemDeleteComponent', () => {
});
mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
delete: observableOf(new RestResponse(true, '200'))
delete: observableOf(new RestResponse(true, 200, 'OK'))
});
routeStub = {
@@ -74,8 +74,8 @@ describe('ItemDeleteComponent', () => {
}));
beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200');
failRestResponse = new RestResponse(false, '500');
successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemDeleteComponent);
comp = fixture.componentInstance;

View File

@@ -45,7 +45,7 @@ describe('ItemPrivateComponent', () => {
});
mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
setDiscoverable: observableOf(new RestResponse(true, '200'))
setDiscoverable: observableOf(new RestResponse(true, 200, 'OK'))
});
routeStub = {
@@ -73,8 +73,8 @@ describe('ItemPrivateComponent', () => {
}));
beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200');
failRestResponse = new RestResponse(false, '500');
successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemPrivateComponent);
comp = fixture.componentInstance;

View File

@@ -45,7 +45,7 @@ describe('ItemReinstateComponent', () => {
});
mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
setWithDrawn: observableOf(new RestResponse(true, '200'))
setWithDrawn: observableOf(new RestResponse(true, 200, 'OK'))
});
routeStub = {
@@ -73,8 +73,8 @@ describe('ItemReinstateComponent', () => {
}));
beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200');
failRestResponse = new RestResponse(false, '500');
successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemReinstateComponent);
comp = fixture.componentInstance;

View File

@@ -45,7 +45,7 @@ describe('ItemWithdrawComponent', () => {
});
mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
setWithDrawn: observableOf(new RestResponse(true, '200'))
setWithDrawn: observableOf(new RestResponse(true, 200, 'OK'))
});
routeStub = {
@@ -73,8 +73,8 @@ describe('ItemWithdrawComponent', () => {
}));
beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200');
failRestResponse = new RestResponse(false, '500');
successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemWithdrawComponent);
comp = fixture.componentInstance;

View File

@@ -28,7 +28,7 @@ describe('ItemDataService', () => {
const responseCache = {
get(href: string) {
const responseCacheEntry = new ResponseCacheEntry();
responseCacheEntry.response = new RestResponse(true, '200');
responseCacheEntry.response = new RestResponse(true, 200, 'OK');
return observableOf(responseCacheEntry);
}
} as ResponseCacheService;
@@ -121,7 +121,7 @@ describe('ItemDataService', () => {
});
it('should setWithDrawn', () => {
const expected = new RestResponse(true, '200');
const expected = new RestResponse(true, 200, 'OK');
const result = service.setWithDrawn(scopeID, true);
result.subscribe((v) => expect(v).toEqual(expected));
@@ -143,7 +143,7 @@ describe('ItemDataService', () => {
});
it('should setDiscoverable', () => {
const expected = new RestResponse(true, '200');
const expected = new RestResponse(true, 200, 'OK');
const result = service.setDiscoverable(scopeID, false);
result.subscribe((v) => expect(v).toEqual(expected));
@@ -164,7 +164,7 @@ describe('ItemDataService', () => {
});
it('should delete the item', () => {
const expected = new RestResponse(true, '200');
const expected = new RestResponse(true, 200, 'OK');
const result = service.delete(scopeID);
result.subscribe((v) => expect(v).toEqual(expected));

View File

@@ -1018,7 +1018,7 @@ export const mockSubmissionDefinition: SubmissionDefinitionsModel = {
self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional'
} as any;
export const mockSubmissionState: SubmissionObjectState = {
export const mockSubmissionState: SubmissionObjectState = Object.assign({}, {
826: {
collection: mockSubmissionCollectionId,
definition: 'traditional',
@@ -1114,9 +1114,9 @@ export const mockSubmissionState: SubmissionObjectState = {
savePending: false,
depositPending: false
}
};
});
export const mockSectionsState = {
export const mockSectionsState = Object.assign({}, {
extraction: {
config: '',
mandatory: true,
@@ -1199,7 +1199,7 @@ export const mockSectionsState = {
isLoading: false,
isValid: false
} as any
};
});
export const mockSectionsList = [
{

View File

@@ -33,7 +33,7 @@ describe('SubmissionFormComponent Component', () => {
const collectionId = mockSubmissionCollectionId;
const submissionObjectNew: any = mockSubmissionObjectNew;
const submissionDefinition: any = mockSubmissionDefinition;
const submissionState: any = mockSubmissionState;
const submissionState: any = Object.assign({}, mockSubmissionState);
const selfUrl: any = mockSubmissionSelfUrl;
const sectionsList: any = mockSectionsList;
const sectionsData: any = mockSectionsData;

View File

@@ -61,6 +61,7 @@ describe('SubmissionObjectEffects test suite', () => {
const submissionDefinitionResponse: any = mockSubmissionDefinitionResponse;
const submissionDefinition: any = mockSubmissionDefinition;
const selfUrl: string = mockSubmissionSelfUrl;
const submissionState: any = Object.assign({}, mockSubmissionState);
beforeEach(() => {
TestBed.configureTestingModule({
@@ -267,7 +268,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a UPLOAD_SECTION_DATA action for each updated section', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -315,7 +316,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should display a success notification', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -360,7 +361,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should display a warning notification when there are errors', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -407,7 +408,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should detect and notify a new section', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -534,7 +535,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should not allow to deposit when there are errors', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -608,7 +609,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DEPOSIT_SUBMISSION_SUCCESS action on success', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -634,7 +635,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DEPOSIT_SUBMISSION_ERROR action on error', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -718,7 +719,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DISCARD_SUBMISSION_SUCCESS action on success', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);
@@ -744,7 +745,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DISCARD_SUBMISSION_ERROR action on error', () => {
store.nextState({
submission: {
objects: mockSubmissionState
objects: submissionState
}
} as any);

View File

@@ -44,7 +44,11 @@ describe('submissionReducer test suite', () => {
const submissionDefinition = mockSubmissionDefinitionResponse;
const selfUrl = mockSubmissionSelfUrl;
const initState: SubmissionObjectState = mockSubmissionState;
let initState: any;
beforeEach(() => {
initState = Object.assign({}, mockSubmissionState);
});
it('should init submission state properly', () => {
const expectedState = {
@@ -164,6 +168,7 @@ describe('submissionReducer test suite', () => {
depositPending: false
}
};
const action = new CompleteInitSubmissionFormAction(submissionId);
const newState = submissionObjectReducer(state, action);

View File

@@ -93,7 +93,7 @@ export class LicenseSectionComponent extends SectionModelComponent {
take(1),
filter((isReadOnly) => isReadOnly))
.subscribe(() => {
model.disabled = true;
model.disabledUpdates.next(true);
});
this.changeDetectorRef.detectChanges();
}),

View File

@@ -41,7 +41,8 @@ describe('SectionsService test suite', () => {
const sectionId = 'traditionalpageone';
const sectionErrors: any = parseSectionErrors(mockSectionsErrors);
const sectionData: any = mockSectionsData;
const sectionState: any = mockSubmissionState['826'].sections[sectionId];
const submissionState: any = Object.assign({}, mockSubmissionState[submissionId]);
const sectionState: any = Object.assign({}, mockSubmissionState['826'].sections[sectionId]);
const store: any = jasmine.createSpyObj('store', {
dispatch: jasmine.createSpy('dispatch'),
@@ -283,7 +284,7 @@ describe('SectionsService test suite', () => {
describe('isSectionAvailable', () => {
it('should return an observable of true when section is available', () => {
store.select.and.returnValue(observableOf(mockSubmissionState[submissionId]));
store.select.and.returnValue(observableOf(submissionState));
const expected = cold('(b|)', {
b: true
@@ -293,7 +294,7 @@ describe('SectionsService test suite', () => {
});
it('should return an observable of false when section is not available', () => {
store.select.and.returnValue(observableOf(mockSubmissionState[submissionId]));
store.select.and.returnValue(observableOf(submissionState));
const expected = cold('(b|)', {
b: false

View File

@@ -85,7 +85,7 @@ describe('UploadSectionComponent test suite', () => {
const submissionId = mockSubmissionId;
const collectionId = mockSubmissionCollectionId;
const submissionState = mockSubmissionState[mockSubmissionId];
const submissionState = Object.assign({}, mockSubmissionState[mockSubmissionId]);
const mockCollection = Object.assign(new Collection(), {
name: 'Community 1-Collection 1',
id: collectionId,
@@ -217,7 +217,6 @@ describe('UploadSectionComponent test suite', () => {
expect(compAsAny.fileList).toEqual([]);
expect(compAsAny.fileIndexes).toEqual([]);
expect(compAsAny.fileNames).toEqual([]);
// this.fileIndexes, this.fileNames).toEqual(expectedGroupsMap);
});