@squiz/component-cli-lib 1.12.0-alpha.2 → 1.12.0-alpha.21
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-02-10T03_34_35_584Z-debug-0.log +39 -0
- package/lib/index.js +112 -119
- package/lib/index.js.map +4 -4
- package/package.json +12 -12
- package/src/component-dev.integration.spec.ts +27 -18
- package/src/integration-tests/upload-and-render-component.integration.spec.ts +2 -1
- 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.12.0-alpha.
|
|
3
|
+
"version": "1.12.0-alpha.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,31 +12,31 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@squiz/component-lib": "1.12.0-alpha.
|
|
16
|
-
"@squiz/component-web-api-lib": "1.12.0-alpha.
|
|
17
|
-
"@squiz/dx-common-lib": "1.12.0-alpha.
|
|
18
|
-
"@squiz/dx-json-schema-lib": "1.12.0-alpha.
|
|
19
|
-
"@squiz/dx-logger-lib": "1.12.0-alpha.
|
|
20
|
-
"@squiz/virus-scanner-lib": "1.12.0-alpha.
|
|
15
|
+
"@squiz/component-lib": "1.12.0-alpha.21",
|
|
16
|
+
"@squiz/component-web-api-lib": "1.12.0-alpha.21",
|
|
17
|
+
"@squiz/dx-common-lib": "1.12.0-alpha.21",
|
|
18
|
+
"@squiz/dx-json-schema-lib": "1.12.0-alpha.21",
|
|
19
|
+
"@squiz/dx-logger-lib": "1.12.0-alpha.21",
|
|
20
|
+
"@squiz/virus-scanner-lib": "1.12.0-alpha.21",
|
|
21
21
|
"@types/cli-color": "2.0.2",
|
|
22
|
-
"@types/express": "4.17.
|
|
22
|
+
"@types/express": "4.17.17",
|
|
23
23
|
"@types/jest": "28.1.8",
|
|
24
24
|
"@types/node": "17.0.27",
|
|
25
25
|
"@types/supertest": "2.0.12",
|
|
26
26
|
"dotenv": "16.0.3",
|
|
27
|
-
"jest": "
|
|
27
|
+
"jest": "29.4.1",
|
|
28
28
|
"ts-jest": "28.0.8",
|
|
29
29
|
"ts-loader": "9.3.1",
|
|
30
30
|
"ts-node": "10.9.1",
|
|
31
31
|
"typescript": "4.9.4"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@squiz/render-runtime-lib": "1.12.0-alpha.
|
|
34
|
+
"@squiz/render-runtime-lib": "1.12.0-alpha.21",
|
|
35
35
|
"archiver": "5.3.1",
|
|
36
|
-
"axios": "
|
|
36
|
+
"axios": "1.3.2",
|
|
37
37
|
"cli-color": "^2.0.2",
|
|
38
38
|
"open": "^8.4.0",
|
|
39
39
|
"supertest": "^6.2.3"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "52e0baca629d181674d9dcd5a83087c1f1f0b324"
|
|
42
42
|
}
|
|
@@ -31,34 +31,43 @@ describe('component-dev', () => {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
describe('definition routes', () => {
|
|
34
|
-
|
|
35
|
-
const request = () => supertest(server);
|
|
36
|
-
routeTests.definition(request, 'http://localhost:0');
|
|
37
|
-
afterAll(() => {
|
|
38
|
-
server.close();
|
|
39
|
-
});
|
|
34
|
+
routeTests.definition(() => request, 'http://localhost:0');
|
|
40
35
|
});
|
|
41
36
|
|
|
42
37
|
describe('static routes', () => {
|
|
43
|
-
|
|
44
|
-
const request = () => supertest(server);
|
|
45
|
-
routeTests.static(request);
|
|
46
|
-
afterAll(() => {
|
|
47
|
-
server.close();
|
|
48
|
-
});
|
|
38
|
+
routeTests.static(() => request);
|
|
49
39
|
});
|
|
50
40
|
|
|
51
41
|
describe('render routes', () => {
|
|
52
|
-
|
|
53
|
-
const request = () => supertest(server);
|
|
54
|
-
routeTests.render(request, 'http://localhost:0');
|
|
55
|
-
afterAll(() => {
|
|
56
|
-
server.close();
|
|
57
|
-
});
|
|
42
|
+
routeTests.render(() => request, 'http://localhost:0');
|
|
58
43
|
});
|
|
59
44
|
|
|
60
45
|
describe('preview tests', () => {
|
|
61
46
|
routeTests.preview(() => request, 'http://localhost:0');
|
|
62
47
|
});
|
|
48
|
+
|
|
49
|
+
describe('user experience', () => {
|
|
50
|
+
describe('on navigation to a component without preview from home page it should still try and render by default', () => {
|
|
51
|
+
it('should successfully try to render a component with a dummy set', async () => {
|
|
52
|
+
const listingResponse = await request.get('/');
|
|
53
|
+
// Component with no preview
|
|
54
|
+
expect(listingResponse.text).toContain(
|
|
55
|
+
'/r/unit-test-components/test-component/1.0.0?_componentSet=local-development-only',
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const renderResponse = await request.get(
|
|
59
|
+
'/r/unit-test-components/test-component/1.0.0?_componentSet=local-development-only',
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
expect(renderResponse.statusCode).not.toEqual(200);
|
|
63
|
+
|
|
64
|
+
const withInputResponse = await request.get(
|
|
65
|
+
'/r/unit-test-components/test-component/1.0.0?_componentSet=local-development-only&something=my-value',
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
expect(withInputResponse.statusCode).toEqual(200);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
63
72
|
});
|
|
64
73
|
});
|
|
@@ -181,7 +181,8 @@ describe('uploading a component', () => {
|
|
|
181
181
|
testFilesDir,
|
|
182
182
|
);
|
|
183
183
|
|
|
184
|
-
const uploadedComponent =
|
|
184
|
+
const uploadedComponent =
|
|
185
|
+
'<a href="/r/smoke-test-components/cmp-static-file-test/1.0.0?_componentSet=local-development-only">1.0.0</a>';
|
|
185
186
|
const get = await supertest(configObj.renderServiceUrl).get('/');
|
|
186
187
|
expect(get.status).toEqual(200);
|
|
187
188
|
expect((get as any)?.res?.text).toContain(uploadedComponent);
|