Commits

lotte authored b98cec011b3
added documentation for endpoint mock service
No tags

src/app/core/core.module.ts

Modified
121 121 import { BrowseDefinition } from './shared/browse-definition.model';
122 122 import { MappedCollectionsReponseParsingService } from './data/mapped-collections-reponse-parsing.service';
123 123 import { ObjectSelectService } from '../shared/object-select/object-select.service';
124 124 import { SiteDataService } from './data/site-data.service';
125 125 import { NormalizedSite } from './cache/models/normalized-site.model';
126 126
127 127 import {
128 128 MOCK_RESPONSE_MAP,
129 129 MockResponseMap,
130 130 mockResponseMap
131 -} from './dspace-rest-v2/mocks/mock-response-map';
132 -import { EndpointMockingRestService } from './dspace-rest-v2/endpoint-mocking-rest.service';
131 +} from '../shared/mocks/dspace-rest-v2/mocks/mock-response-map';
132 +import { EndpointMockingRestService } from '../shared/mocks/dspace-rest-v2/endpoint-mocking-rest.service';
133 133 import { ENV_CONFIG, GLOBAL_CONFIG, GlobalConfig } from '../../config';
134 134 import { SearchFilterService } from './shared/search/search-filter.service';
135 135 import { SearchConfigurationService } from './shared/search/search-configuration.service';
136 136 import { SelectableListService } from '../shared/object-list/selectable-list/selectable-list.service';
137 137 import { RelationshipTypeService } from './data/relationship-type.service';
138 138 import { SidebarService } from '../shared/sidebar/sidebar.service';
139 139
140 +/**
141 + * When not in production, endpoint responses can be mocked for testing purposes
142 + * If there is no mock version available for the endpoint, the actual REST response will be used just like in production mode
143 + */
140 144 export const restServiceFactory = (cfg: GlobalConfig, mocks: MockResponseMap, http: HttpClient) => {
141 145 if (ENV_CONFIG.production) {
142 146 return new DSpaceRESTv2Service(http);
143 147 } else {
144 148 return new EndpointMockingRestService(cfg, mocks, http);
145 149 }
146 150 };
147 151
148 152 const IMPORTS = [
149 153 CommonModule,

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut