@squiz/component-cli-lib 1.51.1-alpha.9 → 1.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npm/_logs/{2023-09-19T02_01_33_582Z-debug-0.log → 2023-09-21T06_46_19_511Z-debug-0.log} +15 -15
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
- package/src/integration-tests/helper.ts +3 -0
- package/src/integration-tests/upload-and-render-page.integration.spec.ts +41 -31
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squiz/component-cli-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.52.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@squiz/component-lib": "1.
|
|
17
|
-
"@squiz/component-web-api-lib": "1.
|
|
18
|
-
"@squiz/dx-common-lib": "1.
|
|
19
|
-
"@squiz/dx-json-schema-lib": "1.
|
|
20
|
-
"@squiz/dx-logger-lib": "1.
|
|
21
|
-
"@squiz/virus-scanner-lib": "1.
|
|
16
|
+
"@squiz/component-lib": "1.52.0",
|
|
17
|
+
"@squiz/component-web-api-lib": "1.52.0",
|
|
18
|
+
"@squiz/dx-common-lib": "1.52.0",
|
|
19
|
+
"@squiz/dx-json-schema-lib": "1.52.0",
|
|
20
|
+
"@squiz/dx-logger-lib": "1.52.0",
|
|
21
|
+
"@squiz/virus-scanner-lib": "1.52.0",
|
|
22
22
|
"@types/cli-color": "2.0.2",
|
|
23
23
|
"@types/express": "4.17.17",
|
|
24
24
|
"@types/jest": "28.1.8",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"typescript": "4.9.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@squiz/render-runtime-lib": "1.
|
|
35
|
+
"@squiz/render-runtime-lib": "1.52.0",
|
|
36
36
|
"archiver": "5.3.1",
|
|
37
37
|
"axios": "1.3.2",
|
|
38
38
|
"cli-color": "^2.0.2",
|
|
39
39
|
"open": "^8.4.0",
|
|
40
40
|
"supertest": "^6.2.3"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "ebbbb74972c60c0479dd5c4fd13e999e11c7ce99"
|
|
43
43
|
}
|
|
@@ -107,7 +107,9 @@ describe('PageRenderController- Integration', () => {
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
it('should render a page', async () => {
|
|
110
|
-
const response = await contentService.post('page-contents', pageContents
|
|
110
|
+
const response = await contentService.post('page-contents', pageContents, {
|
|
111
|
+
headers: { 'x-api-key': 'MOCK_KEY' },
|
|
112
|
+
});
|
|
111
113
|
PAGE_CONTENT_ID = response.data.id!;
|
|
112
114
|
expect(response.status).toBe(201);
|
|
113
115
|
|
|
@@ -185,42 +187,50 @@ describe('PageRenderController- Integration', () => {
|
|
|
185
187
|
},
|
|
186
188
|
],
|
|
187
189
|
};
|
|
188
|
-
const response = await contentService.post('page-contents', pageVariant
|
|
190
|
+
const response = await contentService.post('page-contents', pageVariant, {
|
|
191
|
+
headers: { 'x-api-key': 'MOCK_KEY' },
|
|
192
|
+
});
|
|
189
193
|
PAGE_CONTENT_ID = response.data.id!;
|
|
190
194
|
});
|
|
191
195
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
describe('Variations', () => {
|
|
197
|
+
it('a valid page variation', async () => {
|
|
198
|
+
const mockJwtPayload = {
|
|
199
|
+
segments: ['is-authenticated'],
|
|
200
|
+
customerid: 'test-id-123',
|
|
201
|
+
};
|
|
202
|
+
const mockSession = Buffer.from(JSON.stringify(mockJwtPayload)).toString('base64');
|
|
203
|
+
try {
|
|
204
|
+
const page = await pageRenderService.get(`p/${PAGE_CONTENT_ID}`, {
|
|
205
|
+
headers: { 'x-dxp-customer-session': mockSession },
|
|
206
|
+
});
|
|
207
|
+
expect(page.data).toEqual('<div class="container"><h1>Hello Authenticated User!</h1></div>');
|
|
208
|
+
} catch (error) {
|
|
209
|
+
console.log(JSON.stringify(error, null));
|
|
210
|
+
}
|
|
200
211
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
212
|
+
it('another valid page variation', async () => {
|
|
213
|
+
const mockJwtPayload = {
|
|
214
|
+
segments: ['is-unauthenticated'],
|
|
215
|
+
customerid: 'test-id-123',
|
|
216
|
+
};
|
|
217
|
+
const mockSession = Buffer.from(JSON.stringify(mockJwtPayload)).toString('base64');
|
|
218
|
+
const page = await pageRenderService.get(`p/${PAGE_CONTENT_ID}`, {
|
|
219
|
+
headers: { 'x-dxp-customer-session': mockSession },
|
|
220
|
+
});
|
|
221
|
+
expect(page.data).toEqual('<div class="container"><h1>Hello Unauthenticated User!</h1></div>');
|
|
211
222
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
223
|
+
it('the default node if there is not a valid page variation', async () => {
|
|
224
|
+
const mockJwtPayload = {
|
|
225
|
+
segments: ['not-valid'],
|
|
226
|
+
customerid: 'test-id-123',
|
|
227
|
+
};
|
|
228
|
+
const mockSession = Buffer.from(JSON.stringify(mockJwtPayload)).toString('base64');
|
|
229
|
+
const page = await pageRenderService.get(`p/${PAGE_CONTENT_ID}`, {
|
|
230
|
+
headers: { 'x-dxp-customer-session': mockSession },
|
|
231
|
+
});
|
|
232
|
+
expect(page.data).toEqual('<div class="container"><h1>Hello World!</h1></div>');
|
|
222
233
|
});
|
|
223
|
-
expect(page.data).toEqual('<div class="container"><h1>Hello World!</h1></div>');
|
|
224
234
|
});
|
|
225
235
|
});
|
|
226
236
|
});
|