mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 21:13:07 +00:00
fixed some tests after merge
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IDToUUIDSerializer } from './it-to-uuid-serializer';
|
||||
import { IDToUUIDSerializer } from './id-to-uuid-serializer';
|
||||
|
||||
describe('IDToUUIDSerializer', () => {
|
||||
let serializer: IDToUUIDSerializer;
|
||||
|
@@ -8,6 +8,8 @@ import { CoreState } from '../core.reducers';
|
||||
import { IntegrationResponseParsingService } from './integration-response-parsing.service';
|
||||
import { IntegrationRequest } from '../data/request.models';
|
||||
import { AuthorityValueModel } from './models/authority-value.model';
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
import { PaginatedList } from '../data/paginated-list';
|
||||
|
||||
describe('IntegrationResponseParsingService', () => {
|
||||
let service: IntegrationResponseParsingService;
|
||||
@@ -78,7 +80,7 @@ describe('IntegrationResponseParsingService', () => {
|
||||
|
||||
},
|
||||
_links: {
|
||||
self: 'https://rest.api/integration/authorities/type/entries'
|
||||
self: { href: 'https://rest.api/integration/authorities/type/entries' }
|
||||
}
|
||||
},
|
||||
statusCode: '200'
|
||||
@@ -141,39 +143,44 @@ describe('IntegrationResponseParsingService', () => {
|
||||
},
|
||||
statusCode: '200'
|
||||
};
|
||||
|
||||
const definitions = [
|
||||
Object.assign(new AuthorityValueModel(), {
|
||||
const pageinfo = Object.assign(new PageInfo(), { elementsPerPage: 5, totalElements: 5, totalPages: 1, currentPage: 1 });
|
||||
const definitions = new PaginatedList(pageinfo,[
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'One',
|
||||
id: 'One',
|
||||
otherInformation: {},
|
||||
otherInformation: undefined,
|
||||
value: 'One'
|
||||
}),
|
||||
Object.assign(new AuthorityValueModel(), {
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Two',
|
||||
id: 'Two',
|
||||
otherInformation: {},
|
||||
otherInformation: undefined,
|
||||
value: 'Two'
|
||||
}),
|
||||
Object.assign(new AuthorityValueModel(), {
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Three',
|
||||
id: 'Three',
|
||||
otherInformation: {},
|
||||
otherInformation: undefined,
|
||||
value: 'Three'
|
||||
}),
|
||||
Object.assign(new AuthorityValueModel(), {
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Four',
|
||||
id: 'Four',
|
||||
otherInformation: {},
|
||||
otherInformation: undefined,
|
||||
value: 'Four'
|
||||
}),
|
||||
Object.assign(new AuthorityValueModel(), {
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Five',
|
||||
id: 'Five',
|
||||
otherInformation: {},
|
||||
otherInformation: undefined,
|
||||
value: 'Five'
|
||||
})
|
||||
];
|
||||
]);
|
||||
|
||||
it('should return a IntegrationSuccessResponse if data contains a valid endpoint response', () => {
|
||||
const response = service.parse(validRequest, validResponse);
|
||||
|
@@ -33,7 +33,7 @@ export class IntegrationResponseParsingService extends BaseResponseParsingServic
|
||||
parse(request: RestRequest, data: DSpaceRESTV2Response): RestResponse {
|
||||
if (isNotEmpty(data.payload) && isNotEmpty(data.payload._links)) {
|
||||
const dataDefinition = this.process<IntegrationModel,IntegrationType>(data.payload, request.href);
|
||||
return new IntegrationSuccessResponse(dataDefinition[Object.keys(dataDefinition)[0]], data.statusCode, this.processPageInfo(data.payload.page));
|
||||
return new IntegrationSuccessResponse(dataDefinition, data.statusCode, this.processPageInfo(data.payload.page));
|
||||
} else {
|
||||
return new ErrorResponse(
|
||||
Object.assign(
|
||||
|
Reference in New Issue
Block a user