@pega/custom-dx-components 0.242.35 → 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.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +6 -0
  3. package/src/constants.js +1 -0
  4. package/src/tasks/build-lib/helper.js +0 -1
  5. package/src/tasks/create-lib/index.js +5 -3
  6. package/src/tasks/create-version/index.js +3 -1
  7. package/src/tasks/delete-lib/index.js +4 -1
  8. package/src/tasks/delete-version/index.js +3 -1
  9. package/src/tasks/export-archive/index.js +58 -41
  10. package/src/tasks/import-archive/index.js +5 -1
  11. package/src/tasks/import-comp/helper.js +2 -4
  12. package/src/tasks/import-comp/index.js +1 -2
  13. package/src/tasks/index.js +1 -0
  14. package/src/tasks/init/template/package.json.mustache +3 -2
  15. package/src/tasks/list-lib/index.js +3 -1
  16. package/src/tasks/list-pub/index.js +18 -14
  17. package/src/tasks/move/helper.js +6 -3
  18. package/src/tasks/move/index.js +86 -17
  19. package/src/tasks/publish/helper.js +8 -5
  20. package/src/tasks/publish/index.js +4 -4
  21. package/src/tasks/publish-all/helper.js +16 -10
  22. package/src/tasks/quarantine/index.js +84 -0
  23. package/src/tasks/rename-lib/index.js +0 -1
  24. package/src/tasks/revert-webpack/index.js +0 -2
  25. package/src/tasks/set-perm/index.js +18 -2
  26. package/src/tasks/store/index.js +4 -1
  27. package/src/tasks/switch-lib/index.js +3 -1
  28. package/src/tasks/switch-version/index.js +3 -1
  29. package/src/util.js +50 -6
  30. package/tests/functional/localCreateAllListDeleteAll.test.js +56 -10
  31. package/tests/functional/localCreateBuildAllDeleteAll.test.js +56 -48
  32. package/tests/functional/localCreateBuildDelete.test.js +57 -10
  33. package/tests/functional/localCreateListDelete.test.js +55 -102
  34. package/tests/functional/localCreatePublishAllDeleteAll.test.js +68 -61
  35. package/tests/functional/localCreatePublishDelete.test.js +62 -21
  36. package/tests/functional/localCreateRenameDelete.test.js +55 -140
  37. package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +118 -0
  38. package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +241 -0
  39. package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +246 -0
  40. package/tests/functional/localLibCreateLibDeleteLib.test.js +109 -0
  41. package/tests/functional/localLibCreateLibExportImportLib.test.js +242 -0
  42. package/tests/functional/localLibCreateLibExportLib.test.js +219 -0
  43. package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +131 -0
  44. package/tests/functional/localLibCreateLibListDeleteLib.test.js +261 -0
  45. package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +236 -0
  46. package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +237 -0
  47. package/tests/functional/localLibCreateLibPermDeleteLib.test.js +144 -0
  48. package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +194 -0
  49. package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +453 -0
  50. package/tests/functional/localPromoteRevertWP.test.js +83 -38
@@ -0,0 +1,194 @@
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 showStatus and 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 - ${isLibraryBased}`, async() => {
83
+
84
+ const script = `npm run createLib DXIL 0.0.1 N --prefix ../../..`;
85
+ const compConf = path.join("store", "Pega_DXIL","0.0.1-dev", "componentsconfig.json");
86
+
87
+ const { stdout, stderr } = await exec(script);
88
+ expect(stdout).toContain('Library Pega_DXIL/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 createAll', async () => {
97
+ const script = `npm run createAll "My" 0.0.1 DXIL "" Pega Jest --prefix ../../..`;
98
+
99
+ const { stdout, stderr } = await exec(script);
100
+ // console.log(stdout);
101
+ expect(stdout).not.toBeNull();
102
+ expect(stderr).not.toBeNull();
103
+
104
+ // want message to contain component name
105
+ expect(stdout).toContain('created Pega_DXIL_My');
106
+
107
+ // don't want message with already exists
108
+ expect(stdout).not.toContain('already exists');
109
+
110
+ // check to see file exists
111
+
112
+ // pick one
113
+ const newFileName = 'Pega_DXIL_MyBoolean';
114
+
115
+ // const fileDir = path.resolve(`src/components/${newFileName}`);
116
+ const createFile = path.resolve(
117
+ '../../..',
118
+ path.join(`src/components/${newFileName}`, 'index.tsx')
119
+ );
120
+ const doesExist = fs.existsSync(createFile);
121
+ expect(doesExist).toBeTruthy();
122
+
123
+ // if (doesExist) {
124
+ // // remove it
125
+ // fs.rmdirSync(fileDir, { recursive: true });
126
+ // }
127
+ }, 10000);
128
+
129
+ it('npm run list', async () => {
130
+ const script = 'npm run list --prefix ../../..';
131
+ const { stdout, stderr } = await exec(script);
132
+
133
+ expect(stderr).not.toBeNull();
134
+
135
+ // console.log(stdout);
136
+ expect(stdout).not.toBeNull();
137
+ expect(stdout).toContain('Pega_DXIL_MyText');
138
+ expect(stdout).toContain('Pega_DXIL_MyTextInput');
139
+ expect(stdout).toContain('Pega_DXIL_MyParagraph');
140
+ expect(stdout).toContain('Pega_DXIL_MyEmail');
141
+ expect(stdout).toContain('Pega_DXIL_MyPhone');
142
+ expect(stdout).toContain('Pega_DXIL_MyURL');
143
+ expect(stdout).toContain('Pega_DXIL_MyInteger');
144
+ expect(stdout).toContain('Pega_DXIL_MyDecimal');
145
+ expect(stdout).toContain('Pega_DXIL_MyCurrency');
146
+ expect(stdout).toContain('Pega_DXIL_MyPercentage');
147
+ expect(stdout).toContain('Pega_DXIL_MyBoolean');
148
+ expect(stdout).toContain('Pega_DXIL_MyDate');
149
+ expect(stdout).toContain('Pega_DXIL_MyDateTime');
150
+ expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
151
+ expect(stdout).toContain('Pega_DXIL_MyPicklist');
152
+ expect(stdout).toContain('Pega_DXIL_MySearchbox');
153
+ expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
154
+ expect(stdout).toContain('Pega_DXIL_MyDetails');
155
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
156
+ expect(stdout).toContain('Pega_DXIL_MyForm');
157
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
158
+ expect(stdout).toContain('Pega_DXIL_MyPage');
159
+ expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
160
+ expect(stdout).toContain('Pega_DXIL_MyPageWidget');
161
+ expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
162
+ // done();
163
+ }, 10000);
164
+
165
+ it(`npm run deleteLib- ${isLibraryBased}`, async() => {
166
+
167
+ const script = `npm run showStatus --prefix ../../..`;
168
+ const { stdout, stderr } = await exec(script);
169
+
170
+ expect(stdout).toContain('Organization:');
171
+ expect(stdout).toContain('Pega');
172
+ expect(stdout).toContain('Library:');
173
+ expect(stdout).toContain('DXIL');
174
+ expect(stdout).toContain('Version:');
175
+ expect(stdout).toContain('0.0.1-dev');
176
+ expect(stdout).toContain('Permanent:');
177
+ expect(stdout).toContain('false');
178
+ expect(stdout).toContain('Component count:');
179
+ expect(stdout).toContain('26');
180
+
181
+ }, 30000);
182
+
183
+ it(`npm run deleteLib- ${isLibraryBased}`, async() => {
184
+
185
+ const script = `npm run deleteLib Pega_DXIL 0.0.1-dev --prefix ../../..`;
186
+ const { stdout, stderr } = await exec(script);
187
+
188
+ expect(stdout).toContain('Pega_DXIL is deleted from Local.');
189
+
190
+
191
+ }, 30000);
192
+
193
+
194
+ });
@@ -0,0 +1,453 @@
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 createLibVersion(with copy) switchLibe list deleteLibVersion(all) : ${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
+
55
+ afterAll( async() => {
56
+
57
+ //restore
58
+ isLibraryBased = savedLibraryBased
59
+ tasksConfigJSON['libraryMode'] = isLibraryBased;
60
+
61
+ fs.writeFileSync(tasksConfigDir, JSON.stringify(tasksConfigJSON, null, 4), { encoding: 'utf8' });
62
+
63
+ // return organzation
64
+ packageJSON.organization = savedOrganization;
65
+ fs.writeFileSync(packageJSONDir, JSON.stringify(packageJSON, null, 4), { encoding: 'utf8' });
66
+
67
+ const componentsDir = path.join(path.resolve('../../..'), 'src/components');
68
+ if (fs.existsSync(componentsDir)) {
69
+ fs.rmSync(componentsDir, { recursive: true, force: true, maxRetries: 2 });
70
+ fs.mkdirSync(componentsDir, { recursive: true });
71
+ }
72
+
73
+ const storeDir = path.join(path.resolve('../../..'), 'store');
74
+ if (fs.existsSync(storeDir)) {
75
+ fs.rmSync(storeDir, { recursive: true, force: true, maxRetries: 2 });
76
+ }
77
+
78
+ await new Promise((r) => setTimeout(r, 2000));
79
+
80
+ });
81
+
82
+
83
+ it(`npm run createLib - ${isLibraryBased}`, async() => {
84
+
85
+ const script = `npm run createLib DXIL 0.0.1 N --prefix ../../..`;
86
+ const compConf = path.join("store", "Pega_DXIL","0.0.1-dev", "componentsconfig.json");
87
+
88
+ const { stdout, stderr } = await exec(script);
89
+ expect(stdout).toContain('Library Pega_DXIL/0.0.1-dev has been created!');
90
+
91
+ const doesExist = fs.existsSync(path.resolve('../../..', compConf));
92
+
93
+ expect(doesExist).toBeTruthy();
94
+
95
+ }, 30000);
96
+
97
+ it('npm run createAll', async () => {
98
+ const script = `npm run createAll "My" 0.0.1 DXIL "" Pega Jest --prefix ../../..`;
99
+
100
+ const { stdout, stderr } = await exec(script);
101
+ // console.log(stdout);
102
+ expect(stdout).not.toBeNull();
103
+ expect(stderr).not.toBeNull();
104
+
105
+ // want message to contain component name
106
+ expect(stdout).toContain('created Pega_DXIL_My');
107
+
108
+ // don't want message with already exists
109
+ expect(stdout).not.toContain('already exists');
110
+
111
+ // check to see file exists
112
+
113
+ // pick one
114
+ const newFileName = 'Pega_DXIL_MyBoolean';
115
+
116
+ // const fileDir = path.resolve(`src/components/${newFileName}`);
117
+ const createFile = path.resolve(
118
+ '../../..',
119
+ path.join(`src/components/${newFileName}`, 'index.tsx')
120
+ );
121
+ const doesExist = fs.existsSync(createFile);
122
+ expect(doesExist).toBeTruthy();
123
+
124
+ // if (doesExist) {
125
+ // // remove it
126
+ // fs.rmdirSync(fileDir, { recursive: true });
127
+ // }
128
+ }, 10000);
129
+
130
+ it('npm run list', async () => {
131
+ const script = 'npm run list --prefix ../../..';
132
+ const { stdout, stderr } = await exec(script);
133
+
134
+ expect(stderr).not.toBeNull();
135
+
136
+ // console.log(stdout);
137
+ expect(stdout).not.toBeNull();
138
+ expect(stdout).toContain('Pega_DXIL_MyText');
139
+ expect(stdout).toContain('Pega_DXIL_MyTextInput');
140
+ expect(stdout).toContain('Pega_DXIL_MyParagraph');
141
+ expect(stdout).toContain('Pega_DXIL_MyEmail');
142
+ expect(stdout).toContain('Pega_DXIL_MyPhone');
143
+ expect(stdout).toContain('Pega_DXIL_MyURL');
144
+ expect(stdout).toContain('Pega_DXIL_MyInteger');
145
+ expect(stdout).toContain('Pega_DXIL_MyDecimal');
146
+ expect(stdout).toContain('Pega_DXIL_MyCurrency');
147
+ expect(stdout).toContain('Pega_DXIL_MyPercentage');
148
+ expect(stdout).toContain('Pega_DXIL_MyBoolean');
149
+ expect(stdout).toContain('Pega_DXIL_MyDate');
150
+ expect(stdout).toContain('Pega_DXIL_MyDateTime');
151
+ expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
152
+ expect(stdout).toContain('Pega_DXIL_MyPicklist');
153
+ expect(stdout).toContain('Pega_DXIL_MySearchbox');
154
+ expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
155
+ expect(stdout).toContain('Pega_DXIL_MyDetails');
156
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
157
+ expect(stdout).toContain('Pega_DXIL_MyForm');
158
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
159
+ expect(stdout).toContain('Pega_DXIL_MyPage');
160
+ expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
161
+ expect(stdout).toContain('Pega_DXIL_MyPageWidget');
162
+ expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
163
+ // done();
164
+ }, 10000);
165
+
166
+ it('compare created to default', async () => {
167
+ const compList = [
168
+ 'Pega_DXIL_MyText',
169
+ 'Pega_DXIL_MyTextInput',
170
+ 'Pega_DXIL_MyParagraph',
171
+ 'Pega_DXIL_MyEmail',
172
+ 'Pega_DXIL_MyPhone',
173
+ 'Pega_DXIL_MyURL',
174
+ 'Pega_DXIL_MyInteger',
175
+ 'Pega_DXIL_MyDecimal',
176
+ 'Pega_DXIL_MyCurrency',
177
+ 'Pega_DXIL_MyPercentage',
178
+ 'Pega_DXIL_MyBoolean',
179
+ 'Pega_DXIL_MyDate',
180
+ 'Pega_DXIL_MyDateTime',
181
+ 'Pega_DXIL_MyTimeOfDay',
182
+ 'Pega_DXIL_MyPicklist',
183
+ 'Pega_DXIL_MySearchbox',
184
+ 'Pega_DXIL_MyRadiobuttons',
185
+ 'Pega_DXIL_MyDetails',
186
+ 'Pega_DXIL_MyTwoColumnDetails',
187
+ 'Pega_DXIL_MyForm',
188
+ 'Pega_DXIL_MyTwoColumnForm',
189
+ 'Pega_DXIL_MyPage',
190
+ 'Pega_DXIL_MyCaseWidget',
191
+ 'Pega_DXIL_MyPageWidget',
192
+ 'Pega_DXIL_MyPageCaseWidget'
193
+ ];
194
+
195
+ compList.forEach(component => {
196
+ const componentDir = path.resolve('../../..', `src/components/${component}`);
197
+ const assetDir = path.resolve(`tests/assets/${compType}/components/createAll/${serverDir}/${component}`);
198
+ // get files of directory
199
+ const componentFiles = fs.readdirSync(componentDir);
200
+
201
+ // get files of assets
202
+ // const assetFiles = fs.readdirSync(assetDir);
203
+
204
+ // compare
205
+ componentFiles.forEach(file => {
206
+ const componentFilePath = path.join(componentDir, file);
207
+ const assetFilePath = path.join(assetDir, file);
208
+
209
+ let componentFileData = fs.readFileSync(componentFilePath, { encoding: 'utf8' });
210
+ let assetFileData = fs.readFileSync(assetFilePath, { encoding: 'utf8' });
211
+
212
+ // so that we don't have to generate all new assets, change "version"
213
+ // from 0.0.1-dev to 0.0.1 for now
214
+ if (file === "config.json") {
215
+ expect(componentFileData).toContain("0.0.1-dev");
216
+ componentFileData = componentFileData.replace("0.0.1-dev", "0.0.1");
217
+
218
+ // normalize
219
+ componentFileData = JSON.stringify(JSON.parse(componentFileData));
220
+ assetFileData = JSON.stringify(JSON.parse(assetFileData));
221
+ }
222
+
223
+ expect(componentFileData).toEqual(assetFileData);
224
+ });
225
+ });
226
+ }, 10000);
227
+
228
+ it(`npm run createLibVersion and copy - ${isLibraryBased}`, async() => {
229
+
230
+ const script = `npm run createLibVersion 0.0.2 N Y NoAbout --prefix ../../..`;
231
+ const { stdout, stderr } = await exec(script);
232
+
233
+ expect(stdout).toContain('Library Pega_DXIL/0.0.1-dev has been stored.');
234
+ expect(stdout).toContain('Library Pega_DXIL/0.0.2-dev has been created!');
235
+
236
+ }, 30000);
237
+
238
+ it('npm run list of new version', async () => {
239
+ const script = 'npm run list --prefix ../../..';
240
+ const { stdout, stderr } = await exec(script);
241
+
242
+ expect(stderr).not.toBeNull();
243
+
244
+ // console.log(stdout);
245
+ expect(stdout).not.toBeNull();
246
+ expect(stdout).toContain('Pega_DXIL_MyText');
247
+ expect(stdout).toContain('Pega_DXIL_MyTextInput');
248
+ expect(stdout).toContain('Pega_DXIL_MyParagraph');
249
+ expect(stdout).toContain('Pega_DXIL_MyEmail');
250
+ expect(stdout).toContain('Pega_DXIL_MyPhone');
251
+ expect(stdout).toContain('Pega_DXIL_MyURL');
252
+ expect(stdout).toContain('Pega_DXIL_MyInteger');
253
+ expect(stdout).toContain('Pega_DXIL_MyDecimal');
254
+ expect(stdout).toContain('Pega_DXIL_MyCurrency');
255
+ expect(stdout).toContain('Pega_DXIL_MyPercentage');
256
+ expect(stdout).toContain('Pega_DXIL_MyBoolean');
257
+ expect(stdout).toContain('Pega_DXIL_MyDate');
258
+ expect(stdout).toContain('Pega_DXIL_MyDateTime');
259
+ expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
260
+ expect(stdout).toContain('Pega_DXIL_MyPicklist');
261
+ expect(stdout).toContain('Pega_DXIL_MySearchbox');
262
+ expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
263
+ expect(stdout).toContain('Pega_DXIL_MyDetails');
264
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
265
+ expect(stdout).toContain('Pega_DXIL_MyForm');
266
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
267
+ expect(stdout).toContain('Pega_DXIL_MyPage');
268
+ expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
269
+ expect(stdout).toContain('Pega_DXIL_MyPageWidget');
270
+ expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
271
+ // done();
272
+ }, 10000);
273
+
274
+ it('compare created to default', async () => {
275
+ const compList = [
276
+ 'Pega_DXIL_MyText',
277
+ 'Pega_DXIL_MyTextInput',
278
+ 'Pega_DXIL_MyParagraph',
279
+ 'Pega_DXIL_MyEmail',
280
+ 'Pega_DXIL_MyPhone',
281
+ 'Pega_DXIL_MyURL',
282
+ 'Pega_DXIL_MyInteger',
283
+ 'Pega_DXIL_MyDecimal',
284
+ 'Pega_DXIL_MyCurrency',
285
+ 'Pega_DXIL_MyPercentage',
286
+ 'Pega_DXIL_MyBoolean',
287
+ 'Pega_DXIL_MyDate',
288
+ 'Pega_DXIL_MyDateTime',
289
+ 'Pega_DXIL_MyTimeOfDay',
290
+ 'Pega_DXIL_MyPicklist',
291
+ 'Pega_DXIL_MySearchbox',
292
+ 'Pega_DXIL_MyRadiobuttons',
293
+ 'Pega_DXIL_MyDetails',
294
+ 'Pega_DXIL_MyTwoColumnDetails',
295
+ 'Pega_DXIL_MyForm',
296
+ 'Pega_DXIL_MyTwoColumnForm',
297
+ 'Pega_DXIL_MyPage',
298
+ 'Pega_DXIL_MyCaseWidget',
299
+ 'Pega_DXIL_MyPageWidget',
300
+ 'Pega_DXIL_MyPageCaseWidget'
301
+ ];
302
+
303
+ compList.forEach(component => {
304
+ const componentDir = path.resolve('../../..', `src/components/${component}`);
305
+ const assetDir = path.resolve(`tests/assets/${compType}/components/createAll/${serverDir}/${component}`);
306
+ // get files of directory
307
+ const componentFiles = fs.readdirSync(componentDir);
308
+
309
+ // get files of assets
310
+ // const assetFiles = fs.readdirSync(assetDir);
311
+
312
+ // compare
313
+ componentFiles.forEach(file => {
314
+ const componentFilePath = path.join(componentDir, file);
315
+ const assetFilePath = path.join(assetDir, file);
316
+
317
+ let componentFileData = fs.readFileSync(componentFilePath, { encoding: 'utf8' });
318
+ let assetFileData = fs.readFileSync(assetFilePath, { encoding: 'utf8' });
319
+
320
+ // so that we don't have to generate all new assets, change "version"
321
+ // from 0.0.2-dev to 0.0.1 for now
322
+ if (file === "config.json") {
323
+ expect(componentFileData).toContain("0.0.2-dev");
324
+ componentFileData = componentFileData.replace("0.0.2-dev", "0.0.1");
325
+
326
+ // normalize
327
+ componentFileData = JSON.stringify(JSON.parse(componentFileData));
328
+ assetFileData = JSON.stringify(JSON.parse(assetFileData));
329
+ }
330
+
331
+ expect(componentFileData).toEqual(assetFileData);
332
+ });
333
+ });
334
+ }, 10000);
335
+
336
+ it(`npm run switchLibVersion - ${isLibraryBased}`, async() => {
337
+ // we are at version 0.0.2, switch to 0.0.1
338
+ const script = `npm run switchLibVersion Y 0.0.1-dev NoAbout --prefix ../../..`;
339
+ const { stdout, stderr } = await exec(script);
340
+
341
+ expect(stdout).toContain('Switched to Pega_DXIL/0.0.1-dev!');
342
+
343
+
344
+ }, 30000);
345
+
346
+ it('npm run list of original version', async () => {
347
+ const script = 'npm run list --prefix ../../..';
348
+ const { stdout, stderr } = await exec(script);
349
+
350
+ expect(stderr).not.toBeNull();
351
+
352
+ // console.log(stdout);
353
+ expect(stdout).not.toBeNull();
354
+ expect(stdout).toContain('Pega_DXIL_MyText');
355
+ expect(stdout).toContain('Pega_DXIL_MyTextInput');
356
+ expect(stdout).toContain('Pega_DXIL_MyParagraph');
357
+ expect(stdout).toContain('Pega_DXIL_MyEmail');
358
+ expect(stdout).toContain('Pega_DXIL_MyPhone');
359
+ expect(stdout).toContain('Pega_DXIL_MyURL');
360
+ expect(stdout).toContain('Pega_DXIL_MyInteger');
361
+ expect(stdout).toContain('Pega_DXIL_MyDecimal');
362
+ expect(stdout).toContain('Pega_DXIL_MyCurrency');
363
+ expect(stdout).toContain('Pega_DXIL_MyPercentage');
364
+ expect(stdout).toContain('Pega_DXIL_MyBoolean');
365
+ expect(stdout).toContain('Pega_DXIL_MyDate');
366
+ expect(stdout).toContain('Pega_DXIL_MyDateTime');
367
+ expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
368
+ expect(stdout).toContain('Pega_DXIL_MyPicklist');
369
+ expect(stdout).toContain('Pega_DXIL_MySearchbox');
370
+ expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
371
+ expect(stdout).toContain('Pega_DXIL_MyDetails');
372
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
373
+ expect(stdout).toContain('Pega_DXIL_MyForm');
374
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
375
+ expect(stdout).toContain('Pega_DXIL_MyPage');
376
+ expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
377
+ expect(stdout).toContain('Pega_DXIL_MyPageWidget');
378
+ expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
379
+ // done();
380
+ }, 10000);
381
+
382
+ it('compare created to default', async () => {
383
+ const compList = [
384
+ 'Pega_DXIL_MyText',
385
+ 'Pega_DXIL_MyTextInput',
386
+ 'Pega_DXIL_MyParagraph',
387
+ 'Pega_DXIL_MyEmail',
388
+ 'Pega_DXIL_MyPhone',
389
+ 'Pega_DXIL_MyURL',
390
+ 'Pega_DXIL_MyInteger',
391
+ 'Pega_DXIL_MyDecimal',
392
+ 'Pega_DXIL_MyCurrency',
393
+ 'Pega_DXIL_MyPercentage',
394
+ 'Pega_DXIL_MyBoolean',
395
+ 'Pega_DXIL_MyDate',
396
+ 'Pega_DXIL_MyDateTime',
397
+ 'Pega_DXIL_MyTimeOfDay',
398
+ 'Pega_DXIL_MyPicklist',
399
+ 'Pega_DXIL_MySearchbox',
400
+ 'Pega_DXIL_MyRadiobuttons',
401
+ 'Pega_DXIL_MyDetails',
402
+ 'Pega_DXIL_MyTwoColumnDetails',
403
+ 'Pega_DXIL_MyForm',
404
+ 'Pega_DXIL_MyTwoColumnForm',
405
+ 'Pega_DXIL_MyPage',
406
+ 'Pega_DXIL_MyCaseWidget',
407
+ 'Pega_DXIL_MyPageWidget',
408
+ 'Pega_DXIL_MyPageCaseWidget'
409
+ ];
410
+
411
+ compList.forEach(component => {
412
+ const componentDir = path.resolve('../../..', `src/components/${component}`);
413
+ const assetDir = path.resolve(`tests/assets/${compType}/components/createAll/${serverDir}/${component}`);
414
+ // get files of directory
415
+ const componentFiles = fs.readdirSync(componentDir);
416
+
417
+ // get files of assets
418
+ // const assetFiles = fs.readdirSync(assetDir);
419
+
420
+ // compare
421
+ componentFiles.forEach(file => {
422
+ const componentFilePath = path.join(componentDir, file);
423
+ const assetFilePath = path.join(assetDir, file);
424
+
425
+ let componentFileData = fs.readFileSync(componentFilePath, { encoding: 'utf8' });
426
+ let assetFileData = fs.readFileSync(assetFilePath, { encoding: 'utf8' });
427
+
428
+ // so that we don't have to generate all new assets, change "version"
429
+ // from 0.0.1-dev to 0.0.1 for now
430
+ if (file === "config.json") {
431
+ expect(componentFileData).toContain("0.0.1-dev");
432
+ componentFileData = componentFileData.replace("0.0.1-dev", "0.0.1");
433
+ // normalize
434
+ componentFileData = JSON.stringify(JSON.parse(componentFileData));
435
+ assetFileData = JSON.stringify(JSON.parse(assetFileData));
436
+ }
437
+
438
+ expect(componentFileData).toEqual(assetFileData);
439
+ });
440
+ });
441
+ }, 10000);
442
+
443
+ it(`npm run deleteLibVersion ALL - ${isLibraryBased}`, async() => {
444
+
445
+ const script = `npm run deleteLibVersion ALL --prefix ../../..`;
446
+ const { stdout, stderr } = await exec(script);
447
+
448
+ expect(stdout).toContain('Pega_DXIL is deleted from Local.');
449
+
450
+ }, 30000);
451
+
452
+
453
+ });