@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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +12 -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 +12 -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 +47 -0
  12. package/src/tasks/import-comp/index.js +320 -0
  13. package/src/tasks/index.js +2 -0
  14. package/src/tasks/init/template/package.json.mustache +5 -3
  15. package/src/tasks/list-lib/index.js +25 -16
  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 +99 -58
  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/show-help/index.js +6 -4
  27. package/src/tasks/store/index.js +4 -1
  28. package/src/tasks/switch-lib/index.js +3 -1
  29. package/src/tasks/switch-version/index.js +11 -1
  30. package/src/util.js +84 -25
  31. package/tests/functional/localCreateAllListDeleteAll.test.js +56 -10
  32. package/tests/functional/localCreateBuildAllDeleteAll.test.js +56 -48
  33. package/tests/functional/localCreateBuildDelete.test.js +57 -10
  34. package/tests/functional/localCreateListDelete.test.js +55 -102
  35. package/tests/functional/localCreatePublishAllDeleteAll.test.js +68 -61
  36. package/tests/functional/localCreatePublishDelete.test.js +62 -21
  37. package/tests/functional/localCreateRenameDelete.test.js +55 -140
  38. package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +118 -0
  39. package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +241 -0
  40. package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +246 -0
  41. package/tests/functional/localLibCreateLibDeleteLib.test.js +109 -0
  42. package/tests/functional/localLibCreateLibExportImportLib.test.js +242 -0
  43. package/tests/functional/localLibCreateLibExportLib.test.js +219 -0
  44. package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +131 -0
  45. package/tests/functional/localLibCreateLibListDeleteLib.test.js +261 -0
  46. package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +236 -0
  47. package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +237 -0
  48. package/tests/functional/localLibCreateLibPermDeleteLib.test.js +144 -0
  49. package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +194 -0
  50. package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +453 -0
  51. package/tests/functional/localPromoteRevertWP.test.js +83 -38
@@ -0,0 +1,237 @@
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 createLib switchLb 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
+ await new Promise((r) => setTimeout(r, 2000));
73
+
74
+ });
75
+
76
+
77
+ it(`npm run createLib - ${isLibraryBased}`, async() => {
78
+
79
+
80
+ const script = `npm run createLib DXIL 0.0.1 N --prefix ../../..`;
81
+ const compConf = path.join("store", "Pega_DXIL","0.0.1-dev", "componentsconfig.json");
82
+
83
+ const { stdout, stderr } = await exec(script);
84
+ expect(stdout).toContain('Library Pega_DXIL/0.0.1-dev has been created!');
85
+
86
+ const doesExist = fs.existsSync(path.resolve('../../..', compConf));
87
+
88
+ expect(doesExist).toBeTruthy();
89
+
90
+ }, 30000);
91
+
92
+ it('npm run createAll', async () => {
93
+ const script = `npm run createAll "My" 0.0.1 DXIL "" Pega Jest --prefix ../../..`;
94
+
95
+ const { stdout, stderr } = await exec(script);
96
+ // console.log(stdout);
97
+ expect(stdout).not.toBeNull();
98
+ expect(stderr).not.toBeNull();
99
+
100
+ // want message to contain component name
101
+ expect(stdout).toContain('created Pega_DXIL_My');
102
+
103
+ // don't want message with already exists
104
+ expect(stdout).not.toContain('already exists');
105
+
106
+ // check to see file exists
107
+
108
+ // pick one
109
+ const newFileName = 'Pega_DXIL_MyBoolean';
110
+
111
+ // const fileDir = path.resolve(`src/components/${newFileName}`);
112
+ const createFile = path.resolve(
113
+ '../../..',
114
+ path.join(`src/components/${newFileName}`, 'index.tsx')
115
+ );
116
+ const doesExist = fs.existsSync(createFile);
117
+ expect(doesExist).toBeTruthy();
118
+
119
+ // if (doesExist) {
120
+ // // remove it
121
+ // fs.rmdirSync(fileDir, { recursive: true });
122
+ // }
123
+ }, 10000);
124
+
125
+ it('npm run list', async () => {
126
+ const script = 'npm run list --prefix ../../..';
127
+ const { stdout, stderr } = await exec(script);
128
+
129
+ expect(stderr).not.toBeNull();
130
+
131
+ // console.log(stdout);
132
+ expect(stdout).not.toBeNull();
133
+ expect(stdout).toContain('Pega_DXIL_MyText');
134
+ expect(stdout).toContain('Pega_DXIL_MyTextInput');
135
+ expect(stdout).toContain('Pega_DXIL_MyParagraph');
136
+ expect(stdout).toContain('Pega_DXIL_MyEmail');
137
+ expect(stdout).toContain('Pega_DXIL_MyPhone');
138
+ expect(stdout).toContain('Pega_DXIL_MyURL');
139
+ expect(stdout).toContain('Pega_DXIL_MyInteger');
140
+ expect(stdout).toContain('Pega_DXIL_MyDecimal');
141
+ expect(stdout).toContain('Pega_DXIL_MyCurrency');
142
+ expect(stdout).toContain('Pega_DXIL_MyPercentage');
143
+ expect(stdout).toContain('Pega_DXIL_MyBoolean');
144
+ expect(stdout).toContain('Pega_DXIL_MyDate');
145
+ expect(stdout).toContain('Pega_DXIL_MyDateTime');
146
+ expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
147
+ expect(stdout).toContain('Pega_DXIL_MyPicklist');
148
+ expect(stdout).toContain('Pega_DXIL_MySearchbox');
149
+ expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
150
+ expect(stdout).toContain('Pega_DXIL_MyDetails');
151
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
152
+ expect(stdout).toContain('Pega_DXIL_MyForm');
153
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
154
+ expect(stdout).toContain('Pega_DXIL_MyPage');
155
+ expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
156
+ expect(stdout).toContain('Pega_DXIL_MyPageWidget');
157
+ expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
158
+ // done();
159
+ }, 10000);
160
+
161
+ it(`npm run createLib other - ${isLibraryBased}`, async() => {
162
+
163
+ const script = `npm run createLib Other 0.0.1 N --prefix ../../..`;
164
+ const compConf = path.join("store", "Pega_Other","0.0.1-dev", "componentsconfig.json");
165
+
166
+ const { stdout, stderr } = await exec(script);
167
+ expect(stdout).toContain('Library Pega_Other/0.0.1-dev has been created!');
168
+
169
+ const doesExist = fs.existsSync(path.resolve('../../..', compConf));
170
+
171
+ expect(doesExist).toBeTruthy();
172
+
173
+ }, 30000);
174
+
175
+ it(`npm run switchLib DXIL - ${isLibraryBased}`, async() => {
176
+
177
+ const script = `npm run switchLib Y Pega_DXIL 0.0.1-dev --prefix ../../..`;
178
+
179
+ const { stdout, stderr } = await exec(script);
180
+ expect(stdout).toContain('Switched to Pega_DXIL/0.0.1-dev!');
181
+
182
+ }, 30000);
183
+
184
+ it('npm run list', async () => {
185
+ const script = 'npm run list --prefix ../../..';
186
+ const { stdout, stderr } = await exec(script);
187
+
188
+ expect(stderr).not.toBeNull();
189
+
190
+ // console.log(stdout);
191
+ expect(stdout).not.toBeNull();
192
+ expect(stdout).toContain('Pega_DXIL_MyText');
193
+ expect(stdout).toContain('Pega_DXIL_MyTextInput');
194
+ expect(stdout).toContain('Pega_DXIL_MyParagraph');
195
+ expect(stdout).toContain('Pega_DXIL_MyEmail');
196
+ expect(stdout).toContain('Pega_DXIL_MyPhone');
197
+ expect(stdout).toContain('Pega_DXIL_MyURL');
198
+ expect(stdout).toContain('Pega_DXIL_MyInteger');
199
+ expect(stdout).toContain('Pega_DXIL_MyDecimal');
200
+ expect(stdout).toContain('Pega_DXIL_MyCurrency');
201
+ expect(stdout).toContain('Pega_DXIL_MyPercentage');
202
+ expect(stdout).toContain('Pega_DXIL_MyBoolean');
203
+ expect(stdout).toContain('Pega_DXIL_MyDate');
204
+ expect(stdout).toContain('Pega_DXIL_MyDateTime');
205
+ expect(stdout).toContain('Pega_DXIL_MyTimeOfDay');
206
+ expect(stdout).toContain('Pega_DXIL_MyPicklist');
207
+ expect(stdout).toContain('Pega_DXIL_MySearchbox');
208
+ expect(stdout).toContain('Pega_DXIL_MyRadiobuttons');
209
+ expect(stdout).toContain('Pega_DXIL_MyDetails');
210
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnDetails');
211
+ expect(stdout).toContain('Pega_DXIL_MyForm');
212
+ expect(stdout).toContain('Pega_DXIL_MyTwoColumnForm');
213
+ expect(stdout).toContain('Pega_DXIL_MyPage');
214
+ expect(stdout).toContain('Pega_DXIL_MyCaseWidget');
215
+ expect(stdout).toContain('Pega_DXIL_MyPageWidget');
216
+ expect(stdout).toContain('Pega_DXIL_MyPageCaseWidget');
217
+ // done();
218
+ }, 10000);
219
+
220
+
221
+ it(`npm run deleteLib - ${isLibraryBased}`, async() => {
222
+
223
+ let script = `npm run deleteLib Pega_DXIL 0.0.1-dev --prefix ../../..`;
224
+ let { stdout, stderr } = await exec(script);
225
+
226
+ expect(stdout).toContain('Pega_DXIL is deleted from Local.');
227
+
228
+ script = `npm run deleteLib Pega_Other 0.0.1-dev --prefix ../../..`;
229
+ ({ stdout, stderr } = await exec(script));
230
+
231
+ expect(stdout).toContain('Pega_Other is deleted from Local.');
232
+
233
+
234
+ }, 30000);
235
+
236
+
237
+ });
@@ -0,0 +1,144 @@
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 setPerm setNotPerm 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 setPerm (Y) - ${isLibraryBased}`, async() => {
97
+
98
+ const script = `npm run setPermanent Y --prefix ../../..`;
99
+ const { stdout, stderr } = await exec(script);
100
+
101
+ expect(stdout).toContain('Organization:');
102
+ expect(stdout).toContain('Pega');
103
+ expect(stdout).toContain('Library:');
104
+ expect(stdout).toContain('DXIL');
105
+ expect(stdout).toContain('Version:');
106
+ expect(stdout).toContain('0.0.1');
107
+ expect(stdout).toContain('Permanent:');
108
+ expect(stdout).toContain('true');
109
+ expect(stdout).toContain('Component count:');
110
+ expect(stdout).toContain('0');
111
+
112
+ }, 30000);
113
+
114
+ it(`npm run setPerm (N) - ${isLibraryBased}`, async() => {
115
+
116
+ const script = `npm run setPermanent N --prefix ../../..`;
117
+ const { stdout, stderr } = await exec(script);
118
+
119
+ expect(stdout).toContain('Organization:');
120
+ expect(stdout).toContain('Pega');
121
+ expect(stdout).toContain('Library:');
122
+ expect(stdout).toContain('DXIL');
123
+ expect(stdout).toContain('Version:');
124
+ expect(stdout).toContain('0.0.1-dev');
125
+ expect(stdout).toContain('Permanent:');
126
+ expect(stdout).toContain('false');
127
+ expect(stdout).toContain('Component count:');
128
+ expect(stdout).toContain('0');
129
+
130
+ }, 30000);
131
+
132
+
133
+ it(`npm run deleteLib- ${isLibraryBased}`, async() => {
134
+
135
+ const script = `npm run deleteLib Pega_DXIL 0.0.1-dev --prefix ../../..`;
136
+ const { stdout, stderr } = await exec(script);
137
+
138
+ expect(stdout).toContain('Pega_DXIL is deleted from Local.');
139
+
140
+
141
+ }, 30000);
142
+
143
+
144
+ });
@@ -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
+ });