mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
Merge branch 'w2p-54472_Create-community-and-collection-pages' into w2p-58522_delete-collections-and-communities
This commit is contained in:
@@ -23,15 +23,57 @@ describe('IntegrationResponseParsingService', () => {
|
||||
const uuid = 'd9d30c0c-69b7-4369-8397-ca67c888974d';
|
||||
const integrationEndpoint = 'https://rest.api/integration/authorities';
|
||||
const entriesEndpoint = `${integrationEndpoint}/${name}/entries?query=${query}&metadata=${metadata}&uuid=${uuid}`;
|
||||
let validRequest;
|
||||
|
||||
beforeEach(() => {
|
||||
service = new IntegrationResponseParsingService(EnvConfig, objectCacheService);
|
||||
});
|
||||
let validResponse;
|
||||
|
||||
describe('parse', () => {
|
||||
const validRequest = new IntegrationRequest('69f375b5-19f4-4453-8c7a-7dc5c55aafbb', entriesEndpoint);
|
||||
let invalidResponse1;
|
||||
let invalidResponse2;
|
||||
let pageInfo;
|
||||
let definitions;
|
||||
|
||||
const validResponse = {
|
||||
function initVars() {
|
||||
pageInfo = Object.assign(new PageInfo(), { elementsPerPage: 5, totalElements: 5, totalPages: 1, currentPage: 1, self: 'https://rest.api/integration/authorities/type/entries'});
|
||||
definitions = new PaginatedList(pageInfo,[
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'One',
|
||||
id: 'One',
|
||||
otherInformation: undefined,
|
||||
value: 'One'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Two',
|
||||
id: 'Two',
|
||||
otherInformation: undefined,
|
||||
value: 'Two'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Three',
|
||||
id: 'Three',
|
||||
otherInformation: undefined,
|
||||
value: 'Three'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Four',
|
||||
id: 'Four',
|
||||
otherInformation: undefined,
|
||||
value: 'Four'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Five',
|
||||
id: 'Five',
|
||||
otherInformation: undefined,
|
||||
value: 'Five'
|
||||
})
|
||||
]);
|
||||
validRequest = new IntegrationRequest('69f375b5-19f4-4453-8c7a-7dc5c55aafbb', entriesEndpoint);
|
||||
|
||||
validResponse = {
|
||||
payload: {
|
||||
page: {
|
||||
number: 0,
|
||||
@@ -86,12 +128,12 @@ describe('IntegrationResponseParsingService', () => {
|
||||
statusCode: '200'
|
||||
};
|
||||
|
||||
const invalidResponse1 = {
|
||||
invalidResponse1 = {
|
||||
payload: {},
|
||||
statusCode: '200'
|
||||
};
|
||||
|
||||
const invalidResponse2 = {
|
||||
invalidResponse2 = {
|
||||
payload: {
|
||||
page: {
|
||||
number: 0,
|
||||
@@ -143,45 +185,13 @@ describe('IntegrationResponseParsingService', () => {
|
||||
},
|
||||
statusCode: '200'
|
||||
};
|
||||
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: undefined,
|
||||
value: 'One'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Two',
|
||||
id: 'Two',
|
||||
otherInformation: undefined,
|
||||
value: 'Two'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Three',
|
||||
id: 'Three',
|
||||
otherInformation: undefined,
|
||||
value: 'Three'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Four',
|
||||
id: 'Four',
|
||||
otherInformation: undefined,
|
||||
value: 'Four'
|
||||
}),
|
||||
Object.assign({}, new AuthorityValueModel(), {
|
||||
type: 'authority',
|
||||
display: 'Five',
|
||||
id: 'Five',
|
||||
otherInformation: undefined,
|
||||
value: 'Five'
|
||||
})
|
||||
]);
|
||||
}
|
||||
beforeEach(() => {
|
||||
initVars();
|
||||
service = new IntegrationResponseParsingService(EnvConfig, objectCacheService);
|
||||
});
|
||||
|
||||
describe('parse', () => {
|
||||
it('should return a IntegrationSuccessResponse if data contains a valid endpoint response', () => {
|
||||
const response = service.parse(validRequest, validResponse);
|
||||
expect(response.constructor).toBe(IntegrationSuccessResponse);
|
||||
|
Reference in New Issue
Block a user