testaro 8.1.10 → 8.1.11
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
CHANGED
|
@@ -23,7 +23,7 @@ runJob(jobID)
|
|
|
23
23
|
async () => {
|
|
24
24
|
try {
|
|
25
25
|
// Check it against expectations.
|
|
26
|
-
const reportJSON = await fs.readFile(`${reportDir}/${jobID}.json
|
|
26
|
+
const reportJSON = await fs.readFile(`${reportDir}/${jobID}.json`, 'utf8');
|
|
27
27
|
const report = JSON.parse(reportJSON);
|
|
28
28
|
const {job, acts, jobData} = report;
|
|
29
29
|
if (! job) {
|
|
@@ -1,31 +1,53 @@
|
|
|
1
1
|
// low.js
|
|
2
2
|
// Validator for low-level invocation of Testaro.
|
|
3
3
|
|
|
4
|
+
// ########## IMPORTS
|
|
5
|
+
|
|
4
6
|
const fs = require('fs/promises');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
const
|
|
10
|
-
|
|
7
|
+
|
|
8
|
+
// ########## CONSTANTS
|
|
9
|
+
|
|
10
|
+
const projectRoot = `${__dirname}/../..`;
|
|
11
|
+
const {doJob} = require(`${projectRoot}/run`);
|
|
12
|
+
process.env.JOBDIR = `${projectRoot}/validation/jobs`;
|
|
13
|
+
process.env.REPORTDIR = `${projectRoot}/temp`;
|
|
14
|
+
const jobID = '00000-simple-example';
|
|
15
|
+
|
|
16
|
+
// ########## OPERATION
|
|
17
|
+
|
|
18
|
+
// Get the simple job.
|
|
19
|
+
fs.readFile(`${process.env.JOBDIR}/${jobID}.json`)
|
|
20
|
+
.then(async jobJSON => {
|
|
21
|
+
const job = JSON.parse(jobJSON);
|
|
11
22
|
const report = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
job,
|
|
24
|
+
acts: [],
|
|
25
|
+
jobData: {}
|
|
15
26
|
};
|
|
16
|
-
|
|
27
|
+
// Run it.
|
|
17
28
|
await doJob(report);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
try {
|
|
30
|
+
// Check the report against expectations.
|
|
31
|
+
const reportJSON = await fs.readFile(`${process.env.REPORTDIR}/${jobID}.json`, 'utf8');
|
|
32
|
+
const report = JSON.parse(reportJSON);
|
|
33
|
+
const {job, acts, jobData} = report;
|
|
34
|
+
if (! job) {
|
|
35
|
+
console.log('Failure: Report omits job');
|
|
36
|
+
}
|
|
37
|
+
else if (acts.length !== 3) {
|
|
38
|
+
console.log('Failure: Counts of acts is not 3');
|
|
39
|
+
}
|
|
40
|
+
else if (! jobData) {
|
|
41
|
+
console.log('Failure: Report omits jobData');
|
|
42
|
+
}
|
|
43
|
+
else if (jobData.endTime < jobData.startTime) {
|
|
44
|
+
console.log('Failure: End time precedes start time');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log(`Success (report is in temp/${jobID}.json)`);
|
|
48
|
+
}
|
|
26
49
|
}
|
|
27
|
-
|
|
28
|
-
console.log(
|
|
50
|
+
catch(error) {
|
|
51
|
+
console.log(`ERROR: ${error.message}`);
|
|
29
52
|
}
|
|
30
|
-
};
|
|
31
|
-
validate();
|
|
53
|
+
});
|