|
1 |
| -import { TestBed } from '@angular/core/testing'; |
| 1 | +import { HttpRequest } from '@angular/common/http'; |
2 | 2 | import {
|
3 | 3 | HttpClientTestingModule,
|
4 | 4 | HttpTestingController,
|
5 | 5 | } from '@angular/common/http/testing';
|
6 |
| - |
7 |
| -import { OccCmsPageLoader } from './occ-cms-page.loader'; |
8 |
| -import { IdList } from '../model/idList.model'; |
9 |
| - |
| 6 | +import { TestBed } from '@angular/core/testing'; |
10 | 7 | import {
|
11 | 8 | CmsComponent,
|
| 9 | + CmsComponentList, |
12 | 10 | CMSPage,
|
13 | 11 | PageType,
|
14 |
| - CmsComponentList, |
15 | 12 | } from '../../occ/occ-models/index';
|
| 13 | +import { OccEndpointsService } from '../../occ/services/occ-endpoints.service'; |
16 | 14 | import { PageContext } from '../../routing/index';
|
17 |
| -import { HttpRequest } from '@angular/common/http'; |
18 |
| -import { CmsStructureConfigService, CmsPageAdapter } from '../services'; |
19 | 15 | import { CmsStructureConfig } from '../config';
|
20 |
| -import { OccEndpointsService } from '../../occ/services/occ-endpoints.service'; |
| 16 | +import { IdList } from '../model/idList.model'; |
| 17 | +import { CmsPageAdapter, CmsStructureConfigService } from '../services'; |
| 18 | +import { OccCmsPageLoader } from './occ-cms-page.loader'; |
21 | 19 |
|
22 | 20 | const components: CmsComponent[] = [
|
23 | 21 | { uid: 'comp1', typeCode: 'SimpleBannerComponent' },
|
24 | 22 | { uid: 'comp2', typeCode: 'CMSLinkComponent' },
|
25 | 23 | { uid: 'comp3', typeCode: 'NavigationComponent' },
|
26 | 24 | ];
|
27 | 25 |
|
28 |
| -const component: CmsComponent = components[1]; |
29 |
| - |
30 | 26 | const cmsPageData: CMSPage = {
|
31 | 27 | uid: 'testPageId',
|
32 | 28 | name: 'testPage',
|
@@ -102,54 +98,6 @@ describe('OccCmsPageLoader', () => {
|
102 | 98 | httpMock.verify();
|
103 | 99 | });
|
104 | 100 |
|
105 |
| - describe('Load cms component', () => { |
106 |
| - it('Should get cms component data without parameter fields', () => { |
107 |
| - const context: PageContext = { |
108 |
| - id: 'testProductCode', |
109 |
| - type: PageType.PRODUCT_PAGE, |
110 |
| - }; |
111 |
| - |
112 |
| - service.loadComponent('comp1', context).subscribe(result => { |
113 |
| - expect(result).toEqual(component); |
114 |
| - }); |
115 |
| - |
116 |
| - const testRequest = httpMock.expectOne(req => { |
117 |
| - return ( |
118 |
| - req.method === 'GET' && req.url === endpoint + '/components/comp1' |
119 |
| - ); |
120 |
| - }); |
121 |
| - |
122 |
| - expect(testRequest.request.params.get('productCode')).toEqual( |
123 |
| - 'testProductCode' |
124 |
| - ); |
125 |
| - expect(testRequest.cancelled).toBeFalsy(); |
126 |
| - expect(testRequest.request.responseType).toEqual('json'); |
127 |
| - testRequest.flush(component); |
128 |
| - }); |
129 |
| - |
130 |
| - it('Should get cms component data with parameter fields', () => { |
131 |
| - const context: PageContext = { |
132 |
| - id: 'testPagId', |
133 |
| - type: PageType.CONTENT_PAGE, |
134 |
| - }; |
135 |
| - |
136 |
| - service.loadComponent('comp1', context, 'FULL').subscribe(result => { |
137 |
| - expect(result).toEqual(component); |
138 |
| - }); |
139 |
| - |
140 |
| - const testRequest = httpMock.expectOne(req => { |
141 |
| - return ( |
142 |
| - req.method === 'GET' && req.url === endpoint + '/components/comp1' |
143 |
| - ); |
144 |
| - }); |
145 |
| - expect(testRequest.request.params.get('fields')).toEqual('FULL'); |
146 |
| - |
147 |
| - expect(testRequest.cancelled).toBeFalsy(); |
148 |
| - expect(testRequest.request.responseType).toEqual('json'); |
149 |
| - testRequest.flush(component); |
150 |
| - }); |
151 |
| - }); |
152 |
| - |
153 | 101 | describe('Load cms page data', () => {
|
154 | 102 | it('Should get cms content page data without parameter fields', () => {
|
155 | 103 | const context: PageContext = {
|
|
0 commit comments