@pega/custom-dx-components 0.242.34 → 0.242.36
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/package.json +1 -1
- package/src/cli.js +12 -0
- package/src/constants.js +1 -0
- package/src/tasks/build-lib/helper.js +0 -1
- package/src/tasks/create-lib/index.js +5 -3
- package/src/tasks/create-version/index.js +12 -1
- package/src/tasks/delete-lib/index.js +4 -1
- package/src/tasks/delete-version/index.js +3 -1
- package/src/tasks/export-archive/index.js +58 -41
- package/src/tasks/import-archive/index.js +5 -1
- package/src/tasks/import-comp/helper.js +47 -0
- package/src/tasks/import-comp/index.js +320 -0
- package/src/tasks/index.js +2 -0
- package/src/tasks/init/template/package.json.mustache +5 -3
- package/src/tasks/list-lib/index.js +25 -16
- package/src/tasks/list-pub/index.js +18 -14
- package/src/tasks/move/helper.js +6 -3
- package/src/tasks/move/index.js +99 -58
- package/src/tasks/publish/helper.js +8 -5
- package/src/tasks/publish/index.js +4 -4
- package/src/tasks/publish-all/helper.js +16 -10
- package/src/tasks/quarantine/index.js +84 -0
- package/src/tasks/rename-lib/index.js +0 -1
- package/src/tasks/revert-webpack/index.js +0 -2
- package/src/tasks/set-perm/index.js +18 -2
- package/src/tasks/show-help/index.js +6 -4
- package/src/tasks/store/index.js +4 -1
- package/src/tasks/switch-lib/index.js +3 -1
- package/src/tasks/switch-version/index.js +11 -1
- package/src/util.js +84 -25
- package/tests/functional/localCreateAllListDeleteAll.test.js +56 -10
- package/tests/functional/localCreateBuildAllDeleteAll.test.js +56 -48
- package/tests/functional/localCreateBuildDelete.test.js +57 -10
- package/tests/functional/localCreateListDelete.test.js +55 -102
- package/tests/functional/localCreatePublishAllDeleteAll.test.js +68 -61
- package/tests/functional/localCreatePublishDelete.test.js +62 -21
- package/tests/functional/localCreateRenameDelete.test.js +55 -140
- package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +118 -0
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +241 -0
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +246 -0
- package/tests/functional/localLibCreateLibDeleteLib.test.js +109 -0
- package/tests/functional/localLibCreateLibExportImportLib.test.js +242 -0
- package/tests/functional/localLibCreateLibExportLib.test.js +219 -0
- package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +131 -0
- package/tests/functional/localLibCreateLibListDeleteLib.test.js +261 -0
- package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +236 -0
- package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +237 -0
- package/tests/functional/localLibCreateLibPermDeleteLib.test.js +144 -0
- package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +194 -0
- package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +453 -0
- package/tests/functional/localPromoteRevertWP.test.js +83 -38
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// import { exec } from 'child_process';
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const util = require('node:util');
|
|
5
|
+
const exec = util.promisify(require('node:child_process').exec);
|
|
6
|
+
|
|
7
|
+
const tasksConfigDir = path.resolve('../../..', 'tasks.config.json');
|
|
8
|
+
const tasksConfigData = fs.readFileSync(tasksConfigDir, { encoding: 'utf8' });
|
|
9
|
+
let tasksConfigJSON = JSON.parse(tasksConfigData);
|
|
10
|
+
|
|
11
|
+
const packageJSONDir = path.resolve('../../..', 'package.json');
|
|
12
|
+
const packageJSONData = fs.readFileSync(packageJSONDir, { encoding: 'utf8'});
|
|
13
|
+
let packageJSON = JSON.parse(packageJSONData);
|
|
14
|
+
|
|
15
|
+
let isLibraryBased = tasksConfigJSON['libraryMode'];
|
|
16
|
+
const savedLibraryBased = isLibraryBased;
|
|
17
|
+
const savedOrganization = packageJSON.organization;
|
|
18
|
+
|
|
19
|
+
const serverType = tasksConfigJSON['server-config'].serverType;
|
|
20
|
+
const serverDir = serverType === 'launchpad' ? 'Launchpad' : 'Constellation';
|
|
21
|
+
let compType = isLibraryBased ? "library" : "original";
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
describe(`createLib createAll list deleteVersion deleteLib: ${serverDir} - ${compType}` , () => {
|
|
25
|
+
|
|
26
|
+
beforeAll( async() => {
|
|
27
|
+
|
|
28
|
+
// make libraryBased
|
|
29
|
+
isLibraryBased = true;
|
|
30
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
31
|
+
compType = isLibraryBased ? "library" : "original";
|
|
32
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
33
|
+
|
|
34
|
+
const storeDir = path.join(path.resolve('../../..'), 'store');
|
|
35
|
+
if (fs.existsSync(storeDir)) {
|
|
36
|
+
fs.rmSync(storeDir, { recursive: true, force: true, maxRetries: 2 });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// make organzation Pega
|
|
40
|
+
packageJSON.organization = "Pega";
|
|
41
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
45
|
+
if (fs.existsSync(componentsDir)) {
|
|
46
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
47
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
afterAll( async() => {
|
|
55
|
+
|
|
56
|
+
//restore
|
|
57
|
+
isLibraryBased = savedLibraryBased
|
|
58
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
59
|
+
|
|
60
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
61
|
+
|
|
62
|
+
// return organzation
|
|
63
|
+
packageJSON.organization = savedOrganization;
|
|
64
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
65
|
+
|
|
66
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
67
|
+
if (fs.existsSync(componentsDir)) {
|
|
68
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
69
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const storeDir = path.join(path.resolve('../../..'), 'store');
|
|
73
|
+
if (fs.existsSync(storeDir)) {
|
|
74
|
+
fs.rmSync(storeDir, { recursive: true, force: true, maxRetries: 2 });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
78
|
+
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
it(`npm run createLib (other) - ${isLibraryBased}`, async() => {
|
|
83
|
+
|
|
84
|
+
const script = `npm run createLib Other 0.0.1 N --prefix ../../..`;
|
|
85
|
+
const compConf = path.join("store", "Pega_Other","0.0.1-dev", "componentsconfig.json");
|
|
86
|
+
|
|
87
|
+
const { stdout, stderr } = await exec(script);
|
|
88
|
+
expect(stdout).toContain('Library Pega_Other/0.0.1-dev has been created!');
|
|
89
|
+
|
|
90
|
+
const doesExist = fs.existsSync(path.resolve('../../..', compConf));
|
|
91
|
+
|
|
92
|
+
expect(doesExist).toBeTruthy();
|
|
93
|
+
|
|
94
|
+
}, 30000);
|
|
95
|
+
|
|
96
|
+
it(`npm run createLib (DXIL) - ${isLibraryBased}`, async() => {
|
|
97
|
+
|
|
98
|
+
const script = `npm run createLib DXIL 0.0.1 N --prefix ../../..`;
|
|
99
|
+
const compConf = path.join("store", "Pega_DXIL","0.0.1-dev", "componentsconfig.json");
|
|
100
|
+
|
|
101
|
+
const { stdout, stderr } = await exec(script);
|
|
102
|
+
expect(stdout).toContain('Library Pega_DXIL/0.0.1-dev has been created!');
|
|
103
|
+
|
|
104
|
+
const doesExist = fs.existsSync(path.resolve('../../..', compConf));
|
|
105
|
+
|
|
106
|
+
expect(doesExist).toBeTruthy();
|
|
107
|
+
|
|
108
|
+
}, 30000);
|
|
109
|
+
|
|
110
|
+
it('npm run createAll', async () => {
|
|
111
|
+
const script = `npm run createAll "My" 0.0.1 DXIL "" Pega Jest --prefix ../../..`;
|
|
112
|
+
|
|
113
|
+
const { stdout, stderr } = await exec(script);
|
|
114
|
+
// console.log(stdout);
|
|
115
|
+
expect(stdout).not.toBeNull();
|
|
116
|
+
expect(stderr).not.toBeNull();
|
|
117
|
+
|
|
118
|
+
// want message to contain component name
|
|
119
|
+
expect(stdout).toContain('created Pega_DXIL_My');
|
|
120
|
+
|
|
121
|
+
// don't want message with already exists
|
|
122
|
+
expect(stdout).not.toContain('already exists');
|
|
123
|
+
|
|
124
|
+
// check to see file exists
|
|
125
|
+
|
|
126
|
+
// pick one
|
|
127
|
+
const newFileName = 'Pega_DXIL_MyBoolean';
|
|
128
|
+
|
|
129
|
+
// const fileDir = path.resolve(`src/components/${newFileName}`);
|
|
130
|
+
const createFile = path.resolve(
|
|
131
|
+
'../../..',
|
|
132
|
+
path.join(`src/components/${newFileName}`, 'index.tsx')
|
|
133
|
+
);
|
|
134
|
+
const doesExist = fs.existsSync(createFile);
|
|
135
|
+
expect(doesExist).toBeTruthy();
|
|
136
|
+
|
|
137
|
+
// if (doesExist) {
|
|
138
|
+
// // remove it
|
|
139
|
+
// fs.rmdirSync(fileDir, { recursive: true });
|
|
140
|
+
// }
|
|
141
|
+
}, 10000);
|
|
142
|
+
|
|
143
|
+
it('npm run list', async () => {
|
|
144
|
+
const script = 'npm run list --prefix ../../..';
|
|
145
|
+
const { stdout, stderr } = await exec(script);
|
|
146
|
+
|
|
147
|
+
expect(stderr).not.toBeNull();
|
|
148
|
+
|
|
149
|
+
// console.log(stdout);
|
|
150
|
+
expect(stdout).not.toBeNull();
|
|
151
|
+
expect(stdout).toContain('Pega_DXIL_MyText');
|
|
152
|
+
expect(stdout).toContain('Pega_DXIL_MyTextInput');
|
|
153
|
+
expect(stdout).toContain('Pega_DXIL_MyParagraph');
|
|
154
|
+
expect(stdout).toContain('Pega_DXIL_MyEmail');
|
|
155
|
+
expect(stdout).toContain('Pega_DXIL_MyPhone');
|
|
156
|
+
expect(stdout).toContain('Pega_DXIL_MyURL');
|
|
157
|
+
expect(stdout).toContain('Pega_DXIL_MyInteger');
|
|
158
|
+
expect(stdout).toContain('Pega_DXIL_MyDecimal');
|
|
159
|
+
expect(stdout).toContain('Pega_DXIL_MyCurrency');
|
|
160
|
+
expect(stdout).toContain('Pega_DXIL_MyPercentage');
|
|
161
|
+
expect(stdout).toContain('Pega_DXIL_MyBoolean');
|
|
162
|
+
expect(stdout).toContain('Pega_DXIL_MyDate');
|
|
163
|
+
expect(stdout).toContain('Pega_DXIL_MyDateTime');
|
|
164
|
+
expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
|
|
165
|
+
expect(stdout).toContain('Pega_DXIL_MyPicklist');
|
|
166
|
+
expect(stdout).toContain('Pega_DXIL_MySearchbox');
|
|
167
|
+
expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
|
|
168
|
+
expect(stdout).toContain('Pega_DXIL_MyDetails');
|
|
169
|
+
expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
|
|
170
|
+
expect(stdout).toContain('Pega_DXIL_MyForm');
|
|
171
|
+
expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
|
|
172
|
+
expect(stdout).toContain('Pega_DXIL_MyPage');
|
|
173
|
+
expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
|
|
174
|
+
expect(stdout).toContain('Pega_DXIL_MyPageWidget');
|
|
175
|
+
expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
|
|
176
|
+
// done();
|
|
177
|
+
}, 10000);
|
|
178
|
+
|
|
179
|
+
it('compare created to default', async () => {
|
|
180
|
+
const compList = [
|
|
181
|
+
'Pega_DXIL_MyText',
|
|
182
|
+
'Pega_DXIL_MyTextInput',
|
|
183
|
+
'Pega_DXIL_MyParagraph',
|
|
184
|
+
'Pega_DXIL_MyEmail',
|
|
185
|
+
'Pega_DXIL_MyPhone',
|
|
186
|
+
'Pega_DXIL_MyURL',
|
|
187
|
+
'Pega_DXIL_MyInteger',
|
|
188
|
+
'Pega_DXIL_MyDecimal',
|
|
189
|
+
'Pega_DXIL_MyCurrency',
|
|
190
|
+
'Pega_DXIL_MyPercentage',
|
|
191
|
+
'Pega_DXIL_MyBoolean',
|
|
192
|
+
'Pega_DXIL_MyDate',
|
|
193
|
+
'Pega_DXIL_MyDateTime',
|
|
194
|
+
'Pega_DXIL_MyTimeOfDay',
|
|
195
|
+
'Pega_DXIL_MyPicklist',
|
|
196
|
+
'Pega_DXIL_MySearchbox',
|
|
197
|
+
'Pega_DXIL_MyRadiobuttons',
|
|
198
|
+
'Pega_DXIL_MyDetails',
|
|
199
|
+
'Pega_DXIL_MyTwoColumnDetails',
|
|
200
|
+
'Pega_DXIL_MyForm',
|
|
201
|
+
'Pega_DXIL_MyTwoColumnForm',
|
|
202
|
+
'Pega_DXIL_MyPage',
|
|
203
|
+
'Pega_DXIL_MyCaseWidget',
|
|
204
|
+
'Pega_DXIL_MyPageWidget',
|
|
205
|
+
'Pega_DXIL_MyPageCaseWidget'
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
compList.forEach(component => {
|
|
209
|
+
const componentDir = path.resolve('../../..', `src/components/${component}`);
|
|
210
|
+
const assetDir = path.resolve(`tests/assets/${compType}/components/createAll/${serverDir}/${component}`);
|
|
211
|
+
// get files of directory
|
|
212
|
+
const componentFiles = fs.readdirSync(componentDir);
|
|
213
|
+
|
|
214
|
+
// get files of assets
|
|
215
|
+
// const assetFiles = fs.readdirSync(assetDir);
|
|
216
|
+
|
|
217
|
+
// compare
|
|
218
|
+
componentFiles.forEach(file => {
|
|
219
|
+
const componentFilePath = path.join(componentDir, file);
|
|
220
|
+
const assetFilePath = path.join(assetDir, file);
|
|
221
|
+
|
|
222
|
+
let componentFileData = fs.readFileSync(componentFilePath, { encoding: 'utf8' });
|
|
223
|
+
const assetFileData = fs.readFileSync(assetFilePath, { encoding: 'utf8' });
|
|
224
|
+
|
|
225
|
+
// so that we don't have to generate all new assets, change "version"
|
|
226
|
+
// from 0.0.1-dev to 0.0.1 for now
|
|
227
|
+
if (file === "config.json") {
|
|
228
|
+
expect(componentFileData).toContain("0.0.1-dev");
|
|
229
|
+
componentFileData = componentFileData.replace("0.0.1-dev", "0.0.1");
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
expect(componentFileData).toEqual(assetFileData);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
}, 10000);
|
|
236
|
+
|
|
237
|
+
it(`npm run deleteLibVersion - ${isLibraryBased}`, async() => {
|
|
238
|
+
|
|
239
|
+
// since only version, will delete the lib as well
|
|
240
|
+
|
|
241
|
+
const script = `npm run deleteLibVersion 0.0.1-dev Y --prefix ../../..`;
|
|
242
|
+
const { stdout, stderr } = await exec(script);
|
|
243
|
+
|
|
244
|
+
expect(stdout).toContain('Pega_DXIL is deleted from Local.');
|
|
245
|
+
expect(stdout).toContain('Switched to Pega_Other/0.0.1-dev');
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
}, 30000);
|
|
249
|
+
|
|
250
|
+
it(`npm run deleteLib - ${isLibraryBased}`, async() => {
|
|
251
|
+
|
|
252
|
+
const script = `npm run deleteLib Pega_Other 0.0.1-dev --prefix ../../..`;
|
|
253
|
+
const { stdout, stderr } = await exec(script);
|
|
254
|
+
|
|
255
|
+
expect(stdout).toContain('Pega_Other is deleted from Local.');
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
}, 30000);
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
});
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// import { exec } from 'child_process';
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const util = require('node:util');
|
|
5
|
+
const exec = util.promisify(require('node:child_process').exec);
|
|
6
|
+
|
|
7
|
+
const tasksConfigDir = path.resolve('../../..', 'tasks.config.json');
|
|
8
|
+
const tasksConfigData = fs.readFileSync(tasksConfigDir, { encoding: 'utf8' });
|
|
9
|
+
let tasksConfigJSON = JSON.parse(tasksConfigData);
|
|
10
|
+
|
|
11
|
+
const packageJSONDir = path.resolve('../../..', 'package.json');
|
|
12
|
+
const packageJSONData = fs.readFileSync(packageJSONDir, { encoding: 'utf8'});
|
|
13
|
+
let packageJSON = JSON.parse(packageJSONData);
|
|
14
|
+
|
|
15
|
+
let isLibraryBased = tasksConfigJSON['libraryMode'];
|
|
16
|
+
const savedLibraryBased = isLibraryBased;
|
|
17
|
+
const savedOrganization = packageJSON.organization;
|
|
18
|
+
|
|
19
|
+
const serverType = tasksConfigJSON['server-config'].serverType;
|
|
20
|
+
const serverDir = serverType === 'launchpad' ? 'Launchpad' : 'Constellation';
|
|
21
|
+
let compType = isLibraryBased ? "library" : "original";
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
describe(`createLib createAll list createVersion switchVersion move deleteLib: ${serverDir} - ${compType}` , () => {
|
|
25
|
+
|
|
26
|
+
beforeAll( async() => {
|
|
27
|
+
|
|
28
|
+
// make libraryBased
|
|
29
|
+
isLibraryBased = true;
|
|
30
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
31
|
+
compType = isLibraryBased ? "library" : "original";
|
|
32
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
33
|
+
|
|
34
|
+
const storeDir = path.join(path.resolve('../../..'), 'store');
|
|
35
|
+
if (fs.existsSync(storeDir)) {
|
|
36
|
+
fs.rmSync(storeDir, { recursive: true, force: true, maxRetries: 2 });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// make organzation Pega
|
|
40
|
+
packageJSON.organization = "Pega";
|
|
41
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
45
|
+
if (fs.existsSync(componentsDir)) {
|
|
46
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
47
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
afterAll( async() => {
|
|
55
|
+
|
|
56
|
+
//restore
|
|
57
|
+
isLibraryBased = savedLibraryBased
|
|
58
|
+
tasksConfigJSON['libraryMode'] = isLibraryBased;
|
|
59
|
+
|
|
60
|
+
fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
|
|
61
|
+
|
|
62
|
+
// return organzation
|
|
63
|
+
packageJSON.organization = savedOrganization;
|
|
64
|
+
fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
|
|
65
|
+
|
|
66
|
+
const componentsDir = path.join(path.resolve('../../..'), 'src/components');
|
|
67
|
+
if (fs.existsSync(componentsDir)) {
|
|
68
|
+
fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
|
|
69
|
+
fs.mkdirSync(componentsDir, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const storeDir = path.join(path.resolve('../../..'), 'store');
|
|
73
|
+
if (fs.existsSync(storeDir)) {
|
|
74
|
+
fs.rmSync(storeDir, { recursive: true, force: true, maxRetries: 2 });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
await new Promise((r) => setTimeout(r, 2000));
|
|
78
|
+
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it(`npm run createLib - ${isLibraryBased}`, async() => {
|
|
82
|
+
|
|
83
|
+
const script = `npm run createLib DXIL 0.0.1 N --prefix ../../..`;
|
|
84
|
+
const compConf = path.join("store", "Pega_DXIL","0.0.1-dev", "componentsconfig.json");
|
|
85
|
+
|
|
86
|
+
const { stdout, stderr } = await exec(script);
|
|
87
|
+
expect(stdout).toContain('Library Pega_DXIL/0.0.1-dev has been created!');
|
|
88
|
+
|
|
89
|
+
const doesExist = fs.existsSync(path.resolve('../../..', compConf));
|
|
90
|
+
|
|
91
|
+
expect(doesExist).toBeTruthy();
|
|
92
|
+
|
|
93
|
+
}, 60000);
|
|
94
|
+
|
|
95
|
+
it('npm run createAll', async () => {
|
|
96
|
+
const script = `npm run createAll "My" 0.0.1 DXIL "" Pega Jest --prefix ../../..`;
|
|
97
|
+
|
|
98
|
+
const { stdout, stderr } = await exec(script);
|
|
99
|
+
// console.log(stdout);
|
|
100
|
+
expect(stdout).not.toBeNull();
|
|
101
|
+
expect(stderr).not.toBeNull();
|
|
102
|
+
|
|
103
|
+
// want message to contain component name
|
|
104
|
+
expect(stdout).toContain('created Pega_DXIL_My');
|
|
105
|
+
|
|
106
|
+
// don't want message with already exists
|
|
107
|
+
expect(stdout).not.toContain('already exists');
|
|
108
|
+
|
|
109
|
+
// check to see file exists
|
|
110
|
+
|
|
111
|
+
// pick one
|
|
112
|
+
const newFileName = 'Pega_DXIL_MyBoolean';
|
|
113
|
+
|
|
114
|
+
// const fileDir = path.resolve(`src/components/${newFileName}`);
|
|
115
|
+
const createFile = path.resolve(
|
|
116
|
+
'../../..',
|
|
117
|
+
path.join(`src/components/${newFileName}`, 'index.tsx')
|
|
118
|
+
);
|
|
119
|
+
const doesExist = fs.existsSync(createFile);
|
|
120
|
+
expect(doesExist).toBeTruthy();
|
|
121
|
+
|
|
122
|
+
// if (doesExist) {
|
|
123
|
+
// // remove it
|
|
124
|
+
// fs.rmdirSync(fileDir, { recursive: true });
|
|
125
|
+
// }
|
|
126
|
+
}, 50000);
|
|
127
|
+
|
|
128
|
+
it('npm run list', async () => {
|
|
129
|
+
const script = 'npm run list --prefix ../../..';
|
|
130
|
+
const { stdout, stderr } = await exec(script);
|
|
131
|
+
|
|
132
|
+
expect(stderr).not.toBeNull();
|
|
133
|
+
|
|
134
|
+
// console.log(stdout);
|
|
135
|
+
expect(stdout).not.toBeNull();
|
|
136
|
+
expect(stdout).toContain('Pega_DXIL_MyText');
|
|
137
|
+
expect(stdout).toContain('Pega_DXIL_MyTextInput');
|
|
138
|
+
expect(stdout).toContain('Pega_DXIL_MyParagraph');
|
|
139
|
+
expect(stdout).toContain('Pega_DXIL_MyEmail');
|
|
140
|
+
expect(stdout).toContain('Pega_DXIL_MyPhone');
|
|
141
|
+
expect(stdout).toContain('Pega_DXIL_MyURL');
|
|
142
|
+
expect(stdout).toContain('Pega_DXIL_MyInteger');
|
|
143
|
+
expect(stdout).toContain('Pega_DXIL_MyDecimal');
|
|
144
|
+
expect(stdout).toContain('Pega_DXIL_MyCurrency');
|
|
145
|
+
expect(stdout).toContain('Pega_DXIL_MyPercentage');
|
|
146
|
+
expect(stdout).toContain('Pega_DXIL_MyBoolean');
|
|
147
|
+
expect(stdout).toContain('Pega_DXIL_MyDate');
|
|
148
|
+
expect(stdout).toContain('Pega_DXIL_MyDateTime');
|
|
149
|
+
expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
|
|
150
|
+
expect(stdout).toContain('Pega_DXIL_MyPicklist');
|
|
151
|
+
expect(stdout).toContain('Pega_DXIL_MySearchbox');
|
|
152
|
+
expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
|
|
153
|
+
expect(stdout).toContain('Pega_DXIL_MyDetails');
|
|
154
|
+
expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
|
|
155
|
+
expect(stdout).toContain('Pega_DXIL_MyForm');
|
|
156
|
+
expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
|
|
157
|
+
expect(stdout).toContain('Pega_DXIL_MyPage');
|
|
158
|
+
expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
|
|
159
|
+
expect(stdout).toContain('Pega_DXIL_MyPageWidget');
|
|
160
|
+
expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
|
|
161
|
+
// done();
|
|
162
|
+
}, 50000);
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
it(`npm run createLibVersion and NO copy - ${isLibraryBased}`, async() => {
|
|
167
|
+
|
|
168
|
+
const script = `npm run createLibVersion 0.0.2 N N NoAbout --prefix ../../..`;
|
|
169
|
+
const { stdout, stderr } = await exec(script);
|
|
170
|
+
|
|
171
|
+
expect(stdout).toContain('Library Pega_DXIL/0.0.1-dev has been stored.');
|
|
172
|
+
expect(stdout).toContain('Library Pega_DXIL/0.0.2-dev has been created!');
|
|
173
|
+
|
|
174
|
+
}, 50000);
|
|
175
|
+
|
|
176
|
+
it(`npm run switchLibVersion - ${isLibraryBased}`, async() => {
|
|
177
|
+
// we are at version 0.0.2, switch to 0.0.1
|
|
178
|
+
const script = `npm run switchLibVersion Y 0.0.1-dev NoAbout --prefix ../../..`;
|
|
179
|
+
const { stdout, stderr } = await exec(script);
|
|
180
|
+
|
|
181
|
+
expect(stdout).toContain('Switched to Pega_DXIL/0.0.1-dev!');
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
}, 50000);
|
|
185
|
+
|
|
186
|
+
it(`npm run move (move) - ${isLibraryBased}`, async() => {
|
|
187
|
+
// move a component to version 0.0.2
|
|
188
|
+
const script = `npm run move Move Pega_DXIL_MyCurrency Pega_DXIL 0.0.2-dev Y --prefix ../../..`;
|
|
189
|
+
const { stdout, stderr } = await exec(script);
|
|
190
|
+
|
|
191
|
+
expect(stdout).toContain('Moved Pega_DXIL_MyCurrency to Pega_DXIL/0.0.2-dev as Pega_DXIL_MyCurrency');
|
|
192
|
+
|
|
193
|
+
}, 50000);
|
|
194
|
+
|
|
195
|
+
it(`npm run move (copy) - ${isLibraryBased}`, async() => {
|
|
196
|
+
// copy a component to version 0.0.2
|
|
197
|
+
const script = `npm run move Copy Pega_DXIL_MyDetails Pega_DXIL 0.0.2-dev Y --prefix ../../..`;
|
|
198
|
+
const { stdout, stderr } = await exec(script);
|
|
199
|
+
|
|
200
|
+
expect(stdout).toContain('Copied Pega_DXIL_MyDetails to Pega_DXIL/0.0.2-dev as Pega_DXIL_MyDetails');
|
|
201
|
+
|
|
202
|
+
}, 50000);
|
|
203
|
+
|
|
204
|
+
it(`npm run listLib (0.0.2) - ${isLibraryBased}`, async() => {
|
|
205
|
+
// list 0.0.2-dev and verify it is there
|
|
206
|
+
const script = `npm run listLib Pega_DXIL 0.0.2-dev --prefix ../../..`;
|
|
207
|
+
const { stdout, stderr } = await exec(script);
|
|
208
|
+
|
|
209
|
+
expect(stdout).toContain('Pega_DXIL_MyCurrency');
|
|
210
|
+
expect(stdout).toContain('Pega_DXIL_MyDetails');
|
|
211
|
+
expect(stdout).toContain('0.0.2-dev');
|
|
212
|
+
|
|
213
|
+
}, 30000);
|
|
214
|
+
|
|
215
|
+
it(`npm run list (0.0.1) - ${isLibraryBased}`, async() => {
|
|
216
|
+
// list 0.0.2-dev and verify it is there
|
|
217
|
+
const script = `npm run list --prefix ../../..`;
|
|
218
|
+
const { stdout, stderr } = await exec(script);
|
|
219
|
+
|
|
220
|
+
expect(stdout).not.toContain('Pega_DXIL_MyCurrency');
|
|
221
|
+
expect(stdout).toContain('Pega_DXIL_MyDetails');
|
|
222
|
+
expect(stdout).toContain('0.0.1-dev');
|
|
223
|
+
|
|
224
|
+
}, 40000);
|
|
225
|
+
|
|
226
|
+
it(`npm run deleteLib - ${isLibraryBased}`, async() => {
|
|
227
|
+
|
|
228
|
+
const script = `npm run deleteLib Pega_DXIL ALL Y --prefix ../../..`;
|
|
229
|
+
const { stdout, stderr } = await exec(script);
|
|
230
|
+
|
|
231
|
+
expect(stdout).toContain('Pega_DXIL is deleted from Local.');
|
|
232
|
+
|
|
233
|
+
}, 50000);
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
});
|