testilo 39.2.2 → 40.0.0

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/merge.js CHANGED
@@ -44,7 +44,7 @@ const contaminantNames = new Set([
44
44
  'testaro'
45
45
  ]);
46
46
  // Length of the random merger ID.
47
- const mergeIDLength = 2;
47
+ const mergeIDLength = 3;
48
48
 
49
49
  // ########## FUNCTIONS
50
50
 
@@ -102,6 +102,8 @@ exports.merge = (script, batch, executionTimeStamp) => {
102
102
  const jobs = [];
103
103
  const {targets} = batch;
104
104
  const targetIDs = Object.keys(targets);
105
+ const targetCount = targetIDs.length;
106
+ const targetSuffixWidth = Math.ceil(Math.pow(targetCount, 1 / 36));
105
107
  // For each target in the batch:
106
108
  targetIDs.forEach((what, index) => {
107
109
  const {actGroups, url} = targets[what];
@@ -111,7 +113,7 @@ exports.merge = (script, batch, executionTimeStamp) => {
111
113
  const job = JSON.parse(JSON.stringify(protoJob));
112
114
  const {sources, target} = job;
113
115
  // Make the job ID unique.
114
- const targetSuffix = alphaNumOf(index);
116
+ const targetSuffix = alphaNumOf(index).padStart(targetSuffixWidth, '0');
115
117
  job.id = `${executionTimeStamp}-${sources.mergeID}-${targetSuffix}`;
116
118
  // Populate the target-specific properties of the job.
117
119
  target.what = what;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "39.2.2",
3
+ "version": "40.0.0",
4
4
  "description": "Prepares Testaro jobs and processes Testaro reports",
5
5
  "main": "call.js",
6
6
  "scripts": {
package/procs/util.js CHANGED
@@ -27,16 +27,15 @@
27
27
 
28
28
  // CONSTANTS
29
29
 
30
- // Array of 62 alphanumeric characters.
30
+ // Array of 36 alphanumeric characters.
31
31
  const alphaNumChars = (() => {
32
32
  const digits = Array(10).fill('').map((digit, index) => index.toString());
33
- const uppers = Array(26).fill('').map((letter, index) => String.fromCodePoint(65 + index));
34
33
  const lowers = Array(26).fill('').map((letter, index) => String.fromCodePoint(97 + index));
35
- return digits.concat(uppers, lowers);
34
+ return digits.concat(lowers);
36
35
  })();
37
36
  // Tools.
38
37
  const toolIDs = exports.toolIDs = [
39
- 'alfa', 'aslint', 'axe', 'ed11y', 'htmlcs', 'ibm', 'nuVal', 'qualWeb', 'testaro', 'wave'
38
+ 'alfa', 'aslint', 'axe', 'ed11y', 'htmlcs', 'ibm', 'nuVal', 'qualWeb', 'testaro', 'wave', 'wax'
40
39
  ];
41
40
 
42
41
  // FUNCTIONS
@@ -75,13 +74,13 @@ exports.dateOf = timeStamp => {
75
74
  return null;
76
75
  }
77
76
  };
78
- // Returns a base-62 alphanumeric representation of an integer.
77
+ // Returns a base-36 alphanumeric representation of an integer.
79
78
  exports.alphaNumOf = num => {
80
79
  let resultDigits = [];
81
80
  while (num || ! resultDigits.length) {
82
- const remainder = num % 62;
81
+ const remainder = num % 36;
83
82
  resultDigits.unshift(alphaNumChars[remainder]);
84
- num = Math.floor(num / 62);
83
+ num = Math.floor(num / 36);
85
84
  }
86
85
  return resultDigits.join('');
87
86
  };
@@ -89,7 +88,7 @@ exports.alphaNumOf = num => {
89
88
  const getRandomString = exports.getRandomString = length => {
90
89
  const chars = [];
91
90
  for (let i = 0; i < length; i++) {
92
- chars.push(alphaNumChars[Math.floor(62 * Math.random())]);
91
+ chars.push(alphaNumChars[Math.floor(36 * Math.random())]);
93
92
  }
94
93
  return chars.join('');
95
94
  };