@digicatapult/sqnc-process-management 2.2.130 → 2.2.132

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 (57) hide show
  1. package/build/index.js +95 -0
  2. package/build/index.js.map +1 -0
  3. package/build/lib/process/__tests__/unit.test.js +191 -0
  4. package/build/lib/process/__tests__/unit.test.js.map +1 -0
  5. package/build/lib/process/api.js +206 -0
  6. package/build/lib/process/api.js.map +1 -0
  7. package/build/lib/process/constants.js +5 -0
  8. package/build/lib/process/constants.js.map +1 -0
  9. package/build/{src/lib → lib}/process/hex.js +4 -2
  10. package/build/lib/process/hex.js.map +1 -0
  11. package/build/lib/process/index.js +304 -0
  12. package/build/lib/process/index.js.map +1 -0
  13. package/build/{src/lib → lib}/types/error.js +9 -6
  14. package/build/lib/types/error.js.map +1 -0
  15. package/build/lib/types/polkadot.d.js +2 -0
  16. package/build/lib/types/polkadot.d.js.map +1 -0
  17. package/build/lib/types/process.d.js +2 -0
  18. package/build/lib/types/process.d.js.map +1 -0
  19. package/build/lib/types/validation.js +179 -0
  20. package/build/lib/types/validation.js.map +1 -0
  21. package/build/lib/utils/polkadot.js +26 -0
  22. package/build/lib/utils/polkadot.js.map +1 -0
  23. package/build/version.js +5 -0
  24. package/build/version.js.map +1 -0
  25. package/package.json +13 -11
  26. package/build/package.json +0 -65
  27. package/build/src/index.d.ts +0 -2
  28. package/build/src/index.js +0 -127
  29. package/build/src/lib/process/_tests_/unit.test.d.ts +0 -1
  30. package/build/src/lib/process/_tests_/unit.test.js +0 -112
  31. package/build/src/lib/process/api.d.ts +0 -10
  32. package/build/src/lib/process/api.js +0 -193
  33. package/build/src/lib/process/constants.d.ts +0 -3
  34. package/build/src/lib/process/constants.js +0 -3
  35. package/build/src/lib/process/hex.d.ts +0 -2
  36. package/build/src/lib/process/index.d.ts +0 -22
  37. package/build/src/lib/process/index.js +0 -311
  38. package/build/src/lib/types/error.d.ts +0 -14
  39. package/build/src/lib/types/validation.d.ts +0 -3592
  40. package/build/src/lib/types/validation.js +0 -128
  41. package/build/src/lib/utils/polkadot.d.ts +0 -6
  42. package/build/src/lib/utils/polkadot.js +0 -28
  43. package/build/src/version.d.ts +0 -2
  44. package/build/src/version.js +0 -3
  45. package/build/tests/fixtures/processes.d.ts +0 -281
  46. package/build/tests/fixtures/processes.js +0 -1066
  47. package/build/tests/fixtures/programs.d.ts +0 -14
  48. package/build/tests/fixtures/programs.js +0 -211
  49. package/build/tests/helpers/containers.d.ts +0 -7
  50. package/build/tests/helpers/containers.js +0 -40
  51. package/build/tests/helpers/substrateHelper.d.ts +0 -2
  52. package/build/tests/helpers/substrateHelper.js +0 -100
  53. package/build/tests/integration/command-functions.test.d.ts +0 -1
  54. package/build/tests/integration/command-functions.test.js +0 -414
  55. package/build/tests/integration/without-manual-seal.test.d.ts +0 -1
  56. package/build/tests/integration/without-manual-seal.test.js +0 -52
  57. package/build/tsconfig.tsbuildinfo +0 -1
@@ -1,414 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
11
- if (value !== null && value !== void 0) {
12
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
13
- var dispose, inner;
14
- if (async) {
15
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
16
- dispose = value[Symbol.asyncDispose];
17
- }
18
- if (dispose === void 0) {
19
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
20
- dispose = value[Symbol.dispose];
21
- if (async) inner = dispose;
22
- }
23
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
24
- if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
25
- env.stack.push({ value: value, dispose: dispose, async: async });
26
- }
27
- else if (async) {
28
- env.stack.push({ async: true });
29
- }
30
- return value;
31
- };
32
- var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
33
- return function (env) {
34
- function fail(e) {
35
- env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
36
- env.hasError = true;
37
- }
38
- var r, s = 0;
39
- function next() {
40
- while (r = env.stack.pop()) {
41
- try {
42
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
43
- if (r.dispose) {
44
- var result = r.dispose.call(r.value);
45
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
46
- }
47
- else s |= 1;
48
- }
49
- catch (e) {
50
- fail(e);
51
- }
52
- }
53
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
54
- if (env.hasError) throw env.error;
55
- }
56
- return next();
57
- };
58
- })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
59
- var e = new Error(message);
60
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
61
- });
62
- import { expect } from 'chai';
63
- import { createProcess, disableProcess, loadProcesses } from '../../src/lib/process/index.js';
64
- import { validAllRestrictions, invalidPOSIX, multiple, simple2, simple, invalidRestrictionKey, invalidRestrictionValue, } from '../fixtures/programs.js';
65
- import { Constants } from '../../src/lib/process/constants.js';
66
- import { getVersionHelper } from '../helpers/substrateHelper.js';
67
- import { ZodError } from 'zod';
68
- import { DisableError, ProgramError, VersionError } from '../../src/lib/types/error.js';
69
- import { getAll } from '../../src/lib/process/api.js';
70
- /* fixtures */
71
- import processesExample from '../fixtures/processes.js';
72
- import { withSubstrateNode } from '../helpers/containers.js';
73
- import { createNodeApi } from '../../src/lib/utils/polkadot.js';
74
- const createProcessAndWait = (processRaw, options, dryRun, verbose) => __awaiter(void 0, void 0, void 0, function* () {
75
- const env_1 = { stack: [], error: void 0, hasError: false };
76
- try {
77
- const polkadot = __addDisposableResource(env_1, yield createNodeApi(options), true);
78
- const { waitForFinalised } = yield createProcess(processRaw, dryRun, polkadot, options, verbose);
79
- const result = yield waitForFinalised;
80
- return result;
81
- }
82
- catch (e_1) {
83
- env_1.error = e_1;
84
- env_1.hasError = true;
85
- }
86
- finally {
87
- const result_1 = __disposeResources(env_1);
88
- if (result_1)
89
- yield result_1;
90
- }
91
- });
92
- describe('Process creation and deletion, listing', () => {
93
- const context = {
94
- polkadotOptions: { API_HOST: 'localhost', API_PORT: 0, USER_URI: '//Alice', MANUAL_SEAL: true },
95
- };
96
- withSubstrateNode({ manualSeal: true }, context);
97
- describe('Happy path', () => {
98
- describe('Multiple processes', () => {
99
- it('skips already created processes and creates new ones', () => __awaiter(void 0, void 0, void 0, function* () {
100
- yield createProcessAndWait({
101
- name: 'existing-process-test',
102
- version: 1,
103
- program: simple2,
104
- }, context.polkadotOptions, false);
105
- const process2Name = 'process-to-be-created';
106
- const process2BumpedV = (yield getVersionHelper(process2Name, context.polkadotOptions)) + 1;
107
- const newProcesses = yield loadProcesses({
108
- options: context.polkadotOptions,
109
- data: multiple('existing-process-test', 1, process2Name, process2BumpedV),
110
- });
111
- if (newProcesses.type !== 'ok') {
112
- expect.fail('Expected new process creation to succeed');
113
- }
114
- expect(newProcesses.result['existing-process-test'].type).to.equal('ok');
115
- expect(newProcesses.result['existing-process-test']).to.deep.contain({
116
- message: 'Skipping: process existing-process-test is already created.',
117
- result: {
118
- name: 'existing-process-test',
119
- version: 1,
120
- status: 'Enabled',
121
- },
122
- });
123
- const process2Result = newProcesses.result[process2Name];
124
- if (process2Result.type !== 'ok') {
125
- expect.fail('Expected process create for process2 to succeed');
126
- }
127
- expect(process2Result.message).to.deep.equal('Transaction for new process process-to-be-created has been successfully submitted');
128
- expect(process2Result.result).to.deep.contain({
129
- version: process2BumpedV,
130
- status: 'Enabled',
131
- });
132
- }));
133
- it('creates multiple processes', () => __awaiter(void 0, void 0, void 0, function* () {
134
- const process1Name = 'process-1';
135
- const process1BumpedV = (yield getVersionHelper(process1Name, context.polkadotOptions)) + 1;
136
- const process2Name = 'process-2';
137
- const process2BumpedV = (yield getVersionHelper(process2Name, context.polkadotOptions)) + 1;
138
- const newProcesses = yield loadProcesses({
139
- options: context.polkadotOptions,
140
- data: multiple(process1Name, process1BumpedV, process2Name, process2BumpedV),
141
- });
142
- if (newProcesses.type !== 'ok') {
143
- expect.fail('Expected new process creation to succeed');
144
- }
145
- expect(newProcesses.result[process1Name].message).to.deep.equal('Transaction for new process process-1 has been successfully submitted');
146
- const process1Result = newProcesses.result[process1Name];
147
- if (process1Result.type !== 'ok') {
148
- expect.fail('Expected process1 creation to succeed');
149
- }
150
- expect(process1Result.result).to.deep.contain({
151
- version: process1BumpedV,
152
- status: 'Enabled',
153
- });
154
- const process2Result = newProcesses.result[process2Name];
155
- if (process2Result.type !== 'ok') {
156
- expect.fail('Expected process2 creation to succeed');
157
- }
158
- expect(process2Result.message).to.deep.equal('Transaction for new process process-2 has been successfully submitted');
159
- expect(process2Result.result).to.deep.contain({
160
- version: process2BumpedV,
161
- status: 'Enabled',
162
- });
163
- }));
164
- it('loads and skips multiple processes using number values', () => __awaiter(void 0, void 0, void 0, function* () {
165
- yield loadProcesses({ options: context.polkadotOptions, data: JSON.stringify(processesExample) });
166
- const res = yield loadProcesses({ options: context.polkadotOptions, data: JSON.stringify(processesExample) });
167
- if (res.type !== 'ok') {
168
- expect.fail('Expected process create to succeed');
169
- }
170
- const process1Result = res.result['test-program-create'];
171
- const process2Result = res.result['test-program-propose'];
172
- const process3Result = res.result['test-program-strings-and-numbers'];
173
- if (process1Result.type !== 'ok') {
174
- expect.fail('Expected test-program-create to be already created and succeed');
175
- }
176
- if (process2Result.type !== 'ok') {
177
- expect.fail('Expected test-program-propose to be already created and succeed');
178
- }
179
- if (process2Result.type !== 'ok') {
180
- expect.fail('Expected test-program-strings-and-numbers to be already created and succeed');
181
- }
182
- expect(process1Result.message).to.equal('Skipping: process test-program-create is already created.');
183
- expect(process2Result.message).to.equal('Skipping: process test-program-propose is already created.');
184
- expect(process3Result.message).to.equal('Skipping: process test-program-strings-and-numbers is already created.');
185
- })).timeout(60000);
186
- });
187
- it('creates then disables a process', () => __awaiter(void 0, void 0, void 0, function* () {
188
- const processName = '0';
189
- const currentVersion = yield getVersionHelper(processName, context.polkadotOptions);
190
- const bumpedVersion = currentVersion + 1;
191
- const newProcess = yield createProcessAndWait({ name: processName, version: bumpedVersion, program: simple }, context.polkadotOptions, false);
192
- if (newProcess.type !== 'ok') {
193
- expect.fail('Expected process creation to succeed');
194
- }
195
- expect(newProcess.result).to.deep.equal({
196
- name: processName,
197
- version: bumpedVersion,
198
- status: 'Enabled',
199
- });
200
- const disabledProcess = yield disableProcess(processName, bumpedVersion, false, context.polkadotOptions);
201
- if (disabledProcess.type !== 'ok') {
202
- expect.fail('Expected process disable to succeed');
203
- }
204
- expect(disabledProcess.message).to.equal('Process has been disabled');
205
- expect(disabledProcess.result).to.deep.equal({
206
- name: processName,
207
- version: bumpedVersion,
208
- status: 'Disabled',
209
- });
210
- }));
211
- it('does not create process if dry run', () => __awaiter(void 0, void 0, void 0, function* () {
212
- const processName = '0';
213
- const currentVersion = yield getVersionHelper(processName, context.polkadotOptions);
214
- const bumpedVersion = currentVersion + 1;
215
- const newProcess = yield createProcessAndWait({ name: processName, version: bumpedVersion, program: validAllRestrictions }, context.polkadotOptions, true);
216
- if (newProcess.type !== 'ok') {
217
- expect.fail('Expected process create to succeed');
218
- }
219
- expect(newProcess.message).to.equal('Dry run: transaction has not been created');
220
- expect(newProcess.result).to.deep.equal({
221
- name: processName,
222
- version: bumpedVersion,
223
- status: 'Enabled (dry-run)',
224
- });
225
- }));
226
- it('does not disable process if dry run', () => __awaiter(void 0, void 0, void 0, function* () {
227
- const processName = '0';
228
- const currentVersion = yield getVersionHelper(processName, context.polkadotOptions);
229
- const bumpedVersion = currentVersion + 1;
230
- const newProcess = yield createProcessAndWait({ name: processName, version: bumpedVersion, program: validAllRestrictions }, context.polkadotOptions, false);
231
- expect(newProcess.type).to.equal('ok');
232
- const disabledProcess = yield disableProcess(processName, bumpedVersion, true, context.polkadotOptions);
233
- if (disabledProcess.type !== 'ok') {
234
- expect.fail('Expected disable process to succeed');
235
- }
236
- expect(disabledProcess.result).to.deep.contain({
237
- name: processName,
238
- status: 'Disabled (dry-run)',
239
- });
240
- expect(disabledProcess).to.deep.contain({
241
- message: `This will DISABLE the following process ${processName}`,
242
- });
243
- }));
244
- // it('returns a list of raw processes when with --verbose flag', () => {
245
- it('returns a list of processes', () => __awaiter(void 0, void 0, void 0, function* () {
246
- const res = yield getAll(context.polkadotOptions);
247
- expect(res).to.be.an('array');
248
- expect(res[0])
249
- .to.be.an('object')
250
- .that.has.keys(['name', 'createdAtHash', 'initialU8aLength', 'program', 'status', 'version']);
251
- }));
252
- });
253
- describe('Sad path', () => {
254
- const validProcessName = '0';
255
- let validVersionNumber;
256
- before(() => __awaiter(void 0, void 0, void 0, function* () {
257
- const currentVersion = yield getVersionHelper(validProcessName, context.polkadotOptions);
258
- validVersionNumber = currentVersion + 1;
259
- }));
260
- describe('If process already exists', () => {
261
- describe('Multiple uploads', () => {
262
- // TODO could prestage in before if more scenarios
263
- it('skips and notifies if process programs are different', () => __awaiter(void 0, void 0, void 0, function* () {
264
- yield createProcessAndWait({ name: 'existing-length', version: 1, program: validAllRestrictions }, context.polkadotOptions, false);
265
- const process2Name = 'should-create-1';
266
- const process2BumpedV = (yield getVersionHelper(process2Name, context.polkadotOptions)) + 1;
267
- const res = yield loadProcesses({
268
- options: context.polkadotOptions,
269
- data: multiple('existing-length', 1, process2Name, process2BumpedV),
270
- });
271
- if (res.type !== 'ok') {
272
- expect.fail('Expected overall create to succeed');
273
- }
274
- const failResult = res.result['existing-length'];
275
- if (failResult.type !== 'error') {
276
- expect.fail('Expected existing-length creation to fail');
277
- }
278
- expect(failResult.message).to.equal('existing: programs are different lengths');
279
- const process2Res = res.result[process2Name];
280
- if (process2Res.type !== 'ok') {
281
- expect.fail(`Expected ${process2Name} creation to succeed`);
282
- }
283
- expect(process2Res.message).to.equal('Transaction for new process should-create-1 has been successfully submitted');
284
- }));
285
- it('also fails if number of steps matches but POSTFIX does not', () => __awaiter(void 0, void 0, void 0, function* () {
286
- yield createProcessAndWait({ name: 'existing-steps', version: 1, program: simple }, context.polkadotOptions, false);
287
- const process2Name = 'should-create-2';
288
- const process2BumpedV = (yield getVersionHelper(process2Name, context.polkadotOptions)) + 1;
289
- const res = yield loadProcesses({
290
- options: context.polkadotOptions,
291
- data: multiple('existing-steps', 1, process2Name, process2BumpedV),
292
- });
293
- // TODO: should this fail
294
- if (res.type !== 'ok') {
295
- expect.fail('Expected overall process create to succeed');
296
- }
297
- expect(res.result['existing-steps'].message).to.equal('existing: program steps did not match');
298
- expect(res.result[process2Name].message).to.equal('Transaction for new process should-create-2 has been successfully submitted');
299
- }));
300
- });
301
- it('does not create new one and notifies if programs are different length', () => __awaiter(void 0, void 0, void 0, function* () {
302
- yield createProcessAndWait({ name: 'existing-single', version: 1, program: validAllRestrictions }, context.polkadotOptions, false);
303
- const res = yield createProcessAndWait({ name: 'existing-single', version: 1, program: simple }, context.polkadotOptions, false);
304
- if (res.type !== 'error') {
305
- expect.fail('Expected program create with different lengths to fail');
306
- }
307
- expect(res.message).to.equal('existing: programs are different lengths');
308
- expect(res.error).to.instanceOf(ProgramError);
309
- }));
310
- it('does not create new one and notifies if programs same are length but do not match', () => __awaiter(void 0, void 0, void 0, function* () {
311
- yield createProcessAndWait({ name: 'existing-steps-single', version: 1, program: simple2 }, context.polkadotOptions, false);
312
- const res = yield createProcessAndWait({ name: 'existing-steps-single', version: 1, program: [{ Restriction: 'None' }] }, context.polkadotOptions, false);
313
- if (res.type !== 'error') {
314
- expect.fail('Expected program create with different lengths to fail');
315
- }
316
- expect(res.message).to.equal('existing: program steps did not match');
317
- expect(res.error).to.instanceOf(ProgramError);
318
- const error = res.error;
319
- expect(error.process).to.deep.contain({
320
- name: 'existing-steps-single',
321
- version: 1,
322
- status: 'Enabled',
323
- });
324
- }));
325
- });
326
- it('fails for invalid POSTFIX notation', () => __awaiter(void 0, void 0, void 0, function* () {
327
- const res = yield createProcessAndWait({ name: validProcessName, version: validVersionNumber, program: invalidPOSIX }, context.polkadotOptions, false);
328
- if (res.type !== 'error') {
329
- expect.fail('Expected process create to fail');
330
- }
331
- expect(res.error).to.be.instanceOf(ProgramError);
332
- expect(res.message).to.equal('invalid program');
333
- }));
334
- it('fails for invalid restriction key', () => __awaiter(void 0, void 0, void 0, function* () {
335
- const res = yield createProcessAndWait({
336
- name: validProcessName,
337
- version: validVersionNumber,
338
- program: invalidRestrictionKey,
339
- }, context.polkadotOptions, false);
340
- if (res.type !== 'error') {
341
- expect.fail('Expected process create to fail');
342
- }
343
- expect(res.error).to.be.instanceOf(ZodError);
344
- const zError = res.error;
345
- expect(zError.issues[0]).to.deep.contain({
346
- code: 'invalid_union',
347
- message: 'Invalid input',
348
- });
349
- }));
350
- it('fails for invalid restriction value', () => __awaiter(void 0, void 0, void 0, function* () {
351
- const res = yield createProcessAndWait({ name: validProcessName, version: validVersionNumber, program: invalidRestrictionValue }, context.polkadotOptions, false);
352
- if (res.type !== 'error') {
353
- expect.fail('Expected process create to fail');
354
- }
355
- expect(res.error).to.be.instanceOf(ZodError);
356
- }));
357
- it('fails for invalid json', () => __awaiter(void 0, void 0, void 0, function* () {
358
- const res = yield createProcessAndWait({ name: validProcessName, version: validVersionNumber, program: 'invalidJson' }, context.polkadotOptions, false);
359
- if (res.type !== 'error') {
360
- expect.fail('Expected process create to fail');
361
- }
362
- expect(res.error).to.be.instanceOf(ZodError);
363
- }));
364
- it('fails to create for too low version', () => __awaiter(void 0, void 0, void 0, function* () {
365
- // - 2 because -1 would make current = valid
366
- const res = yield createProcessAndWait({ name: validProcessName, version: validVersionNumber - 2, program: validAllRestrictions }, context.polkadotOptions, false);
367
- if (res.type !== 'error') {
368
- expect.fail('Expected process create to fail');
369
- }
370
- expect(res.message).to.equal(`Process version ${validVersionNumber - 2} is invalid. If you are trying to create a new version of process ${validProcessName} version should be ${validVersionNumber}`);
371
- expect(res.error).to.be.instanceOf(VersionError);
372
- }));
373
- it('fails to create for too high version', () => __awaiter(void 0, void 0, void 0, function* () {
374
- const res = yield createProcessAndWait({ name: validProcessName, version: validVersionNumber + 1, program: validAllRestrictions }, context.polkadotOptions, false);
375
- if (res.type !== 'error') {
376
- expect.fail('Expected process create to fail');
377
- }
378
- expect(res.message).to.equal(`Process version ${validVersionNumber + 1} is invalid. If you are trying to create a new version of process ${validProcessName} version should be ${validVersionNumber}`);
379
- expect(res.error).to.be.instanceOf(VersionError);
380
- }));
381
- it('fails to create with too long process id', () => __awaiter(void 0, void 0, void 0, function* () {
382
- const processName = '0'.repeat(Constants.PROCESS_ID_LENGTH + 1);
383
- const res = yield createProcessAndWait({ name: processName, version: 1, program: validAllRestrictions }, context.polkadotOptions, false);
384
- if (res.type !== 'error') {
385
- expect.fail('Expected process create to fail');
386
- }
387
- expect(res.error).to.be.instanceOf(ZodError);
388
- }));
389
- it('fails to disable process that does not exist', () => __awaiter(void 0, void 0, void 0, function* () {
390
- let err = null;
391
- try {
392
- yield disableProcess('incorrectProcessName', 1, false, context.polkadotOptions);
393
- }
394
- catch (error) {
395
- err = error;
396
- }
397
- expect(err).instanceOf(DisableError);
398
- }));
399
- it('fails to disable process a second time', () => __awaiter(void 0, void 0, void 0, function* () {
400
- const newProcess = yield createProcessAndWait({ name: validProcessName, version: validVersionNumber, program: simple }, context.polkadotOptions, false);
401
- expect(newProcess.type).to.equal('ok');
402
- const firstDisable = yield disableProcess(validProcessName, validVersionNumber, false, context.polkadotOptions);
403
- expect(firstDisable.type).to.equal('ok');
404
- let err = null;
405
- try {
406
- yield disableProcess(validProcessName, validVersionNumber, false, context.polkadotOptions);
407
- }
408
- catch (error) {
409
- err = error;
410
- }
411
- expect(err).instanceOf(DisableError);
412
- }));
413
- });
414
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,52 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { expect } from 'chai';
11
- import { loadProcesses } from '../../src/lib/process/index.js';
12
- import { multiple } from '../fixtures/programs.js';
13
- import { getVersionHelper } from '../helpers/substrateHelper.js';
14
- import { withSubstrateNode } from '../helpers/containers.js';
15
- describe('Transactions without manual seal', function () {
16
- this.timeout(60000);
17
- const context = {
18
- polkadotOptions: { API_HOST: 'localhost', API_PORT: 0, USER_URI: '//Alice', MANUAL_SEAL: false },
19
- };
20
- withSubstrateNode({ manualSeal: false }, context);
21
- it('creates multiple processes', () => __awaiter(this, void 0, void 0, function* () {
22
- const process1Name = 'process-1';
23
- const process1BumpedV = (yield getVersionHelper(process1Name, context.polkadotOptions)) + 1;
24
- const process2Name = 'process-2';
25
- const process2BumpedV = (yield getVersionHelper(process2Name, context.polkadotOptions)) + 1;
26
- const newProcesses = yield loadProcesses({
27
- options: context.polkadotOptions,
28
- data: multiple(process1Name, process1BumpedV, process2Name, process2BumpedV),
29
- });
30
- if (newProcesses.type !== 'ok') {
31
- expect.fail('Expected new process creation to succeed');
32
- }
33
- expect(newProcesses.result[process1Name].message).to.deep.equal('Transaction for new process process-1 has been successfully submitted');
34
- const process1Result = newProcesses.result[process1Name];
35
- if (process1Result.type !== 'ok') {
36
- expect.fail('Expected process1 creation to succeed');
37
- }
38
- expect(process1Result.result).to.deep.contain({
39
- version: process1BumpedV,
40
- status: 'Enabled',
41
- });
42
- const process2Result = newProcesses.result[process2Name];
43
- if (process2Result.type !== 'ok') {
44
- expect.fail('Expected process2 creation to succeed');
45
- }
46
- expect(process2Result.message).to.deep.equal('Transaction for new process process-2 has been successfully submitted');
47
- expect(process2Result.result).to.deep.contain({
48
- version: process2BumpedV,
49
- status: 'Enabled',
50
- });
51
- }));
52
- });
@@ -1 +0,0 @@
1
- {"root":["../src/index.ts","../src/version.ts","../src/lib/process/api.ts","../src/lib/process/constants.ts","../src/lib/process/hex.ts","../src/lib/process/index.ts","../src/lib/process/_tests_/unit.test.ts","../src/lib/types/error.ts","../src/lib/types/polkadot.d.ts","../src/lib/types/process.d.ts","../src/lib/types/validation.ts","../src/lib/utils/polkadot.ts","../tests/fixtures/processes.ts","../tests/fixtures/programs.ts","../tests/helpers/containers.ts","../tests/helpers/substrateHelper.ts","../tests/integration/command-functions.test.ts","../tests/integration/without-manual-seal.test.ts"],"version":"5.6.3"}