mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge branch 'master' into resolvers-branch-angular6
Conflicts: package.json src/app/+search-page/search-filters/search-filters.component.ts src/app/core/auth/auth.effects.ts src/app/core/auth/auth.service.ts src/app/core/auth/server-auth.service.ts src/app/core/data/comcol-data.service.ts src/app/core/data/community-data.service.ts src/app/core/data/data.service.ts src/app/core/data/item-data.service.ts src/app/core/shared/dspace-object.model.ts src/app/header/header.component.spec.ts src/app/shared/auth-nav-menu/auth-nav-menu.component.ts src/app/shared/testing/auth-service-stub.ts yarn.lock
This commit is contained in:
@@ -9,7 +9,7 @@ import { ResponseCacheService } from '../cache/response-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ComColDataService } from './comcol-data.service';
|
||||
import { CommunityDataService } from './community-data.service';
|
||||
import { FindByIDRequest } from './request.models';
|
||||
import { FindAllOptions, FindByIDRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
@@ -52,6 +52,10 @@ describe('ComColDataService', () => {
|
||||
const EnvConfig = {} as GlobalConfig;
|
||||
|
||||
const scopeID = 'd9d30c0c-69b7-4369-8397-ca67c888974d';
|
||||
const options = Object.assign(new FindAllOptions(), {
|
||||
scopeID: scopeID
|
||||
});
|
||||
|
||||
const communitiesEndpoint = 'https://rest.api/core/communities';
|
||||
const communityEndpoint = `${communitiesEndpoint}/${scopeID}`;
|
||||
const scopedEndpoint = `${communityEndpoint}/${LINK_NAME}`;
|
||||
@@ -98,7 +102,7 @@ describe('ComColDataService', () => {
|
||||
);
|
||||
}
|
||||
|
||||
describe('getScopedEndpoint', () => {
|
||||
describe('getBrowseEndpoint', () => {
|
||||
beforeEach(() => {
|
||||
scheduler = getTestScheduler();
|
||||
});
|
||||
@@ -112,7 +116,7 @@ describe('ComColDataService', () => {
|
||||
|
||||
const expected = new FindByIDRequest(requestService.generateRequestId(), communityEndpoint, scopeID);
|
||||
|
||||
scheduler.schedule(() => service.getScopedEndpoint(scopeID).subscribe());
|
||||
scheduler.schedule(() => service.getBrowseEndpoint(options).subscribe());
|
||||
scheduler.flush();
|
||||
|
||||
expect(requestService.configure).toHaveBeenCalledWith(expected);
|
||||
@@ -128,13 +132,13 @@ describe('ComColDataService', () => {
|
||||
});
|
||||
|
||||
it('should fetch the scope Community from the cache', () => {
|
||||
scheduler.schedule(() => service.getScopedEndpoint(scopeID).subscribe());
|
||||
scheduler.schedule(() => service.getBrowseEndpoint(options).subscribe());
|
||||
scheduler.flush();
|
||||
expect(objectCache.getByUUID).toHaveBeenCalledWith(scopeID);
|
||||
});
|
||||
|
||||
it('should return the endpoint to fetch resources within the given scope', () => {
|
||||
const result = service.getScopedEndpoint(scopeID);
|
||||
const result = service.getBrowseEndpoint(options);
|
||||
const expected = cold('--e-', { e: scopedEndpoint });
|
||||
|
||||
expect(result).toBeObservable(expected);
|
||||
@@ -151,7 +155,7 @@ describe('ComColDataService', () => {
|
||||
});
|
||||
|
||||
it('should throw an error', () => {
|
||||
const result = service.getScopedEndpoint(scopeID);
|
||||
const result = service.getBrowseEndpoint(options);
|
||||
const expected = cold('--#-', undefined, new Error(`The Community with scope ${scopeID} couldn't be retrieved`));
|
||||
|
||||
expect(result).toBeObservable(expected);
|
||||
|
Reference in New Issue
Block a user