@nsshunt/ststestrunner 1.1.157 → 1.1.159
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/dist/ststestrunner.cjs +63 -5
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +63 -5
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +1 -1
- package/types/libmodule/asyncRunnerFactory.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir02.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir03.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir04.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir20.d.ts +7 -0
- package/types/libmodule/testCaseFhir20.d.ts.map +1 -0
- package/types/libmodule/testCaseFhirBase.d.ts +2 -0
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -1
- package/types/libmodule/workerFhirTestCases.d.ts +3 -0
- package/types/libmodule/workerFhirTestCases.d.ts.map +1 -1
package/dist/ststestrunner.cjs
CHANGED
|
@@ -1004,14 +1004,22 @@ var TestCaseFhirBase = class {
|
|
|
1004
1004
|
get runnerExecutionWorker() {
|
|
1005
1005
|
return this.#runnerExecutionWorker;
|
|
1006
1006
|
}
|
|
1007
|
+
GetMaxIteration(key) {
|
|
1008
|
+
return this.runnerExecutionWorker.GetMaxIteration(key);
|
|
1009
|
+
}
|
|
1010
|
+
SetMaxIteration(key, maxIteration) {
|
|
1011
|
+
this.runnerExecutionWorker.SetMaxIteration(key, maxIteration);
|
|
1012
|
+
}
|
|
1007
1013
|
ResetClient = () => {};
|
|
1008
1014
|
GetRandomSequenceFromIteration = () => {
|
|
1015
|
+
const prefix = this.runner.options.personPrefix;
|
|
1016
|
+
const maxIterations = this.GetMaxIteration(prefix);
|
|
1009
1017
|
if (this.runner.iteration === 0) {
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
this.randomSequence = getRandomIterationOrder(this.runner.options.executionProfile.iterations, seedId);
|
|
1018
|
+
const seedId = prefix;
|
|
1019
|
+
this.randomSequence = getRandomIterationOrder(maxIterations, seedId);
|
|
1013
1020
|
}
|
|
1014
|
-
|
|
1021
|
+
const useIteration = this.runner.iteration % maxIterations;
|
|
1022
|
+
return this.randomSequence[useIteration];
|
|
1015
1023
|
};
|
|
1016
1024
|
Error = (message) => {
|
|
1017
1025
|
this.#runnerExecutionWorker.logger.error(message);
|
|
@@ -1471,6 +1479,7 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
1471
1479
|
"entry": []
|
|
1472
1480
|
};
|
|
1473
1481
|
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
1482
|
+
this.SetMaxIteration(prefix, this.runner.iteration);
|
|
1474
1483
|
const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
|
|
1475
1484
|
const foundIndexPersonRecords = this.personRecords.findIndex((p) => p.id?.localeCompare(personRecord.id) === 0);
|
|
1476
1485
|
const foundIndexBindlePersonRecords = this.bundleBatch.entry.findIndex((p) => p.resource.id?.localeCompare(personRecord.id) === 0);
|
|
@@ -1516,7 +1525,8 @@ var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
|
|
|
1516
1525
|
const __snapshot1 = performance.now();
|
|
1517
1526
|
const client = await this.GetClient();
|
|
1518
1527
|
const __snapshot2 = this._CheckOutputLongDurationError(__snapshot1, "await this.GetClient()");
|
|
1519
|
-
const
|
|
1528
|
+
const prefix = this.runner.options.personPrefix;
|
|
1529
|
+
const personRecord = await this.GetPersonRecord(prefix, this.GetRandomSequenceFromIteration(), "1");
|
|
1520
1530
|
const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
|
|
1521
1531
|
const retVal = await client.GetResource("Person", personRecord.id);
|
|
1522
1532
|
this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
|
|
@@ -2387,6 +2397,46 @@ var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
|
2387
2397
|
};
|
|
2388
2398
|
};
|
|
2389
2399
|
//#endregion
|
|
2400
|
+
//#region src/libmodule/testCaseFhir20.ts
|
|
2401
|
+
var TestCaseFhir20 = class extends TestCaseFhirQueryBase {
|
|
2402
|
+
PerformExecuteQuery = async () => {
|
|
2403
|
+
const client = await this.GetClient();
|
|
2404
|
+
const prefix = this.runner.options.personPrefix;
|
|
2405
|
+
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
2406
|
+
const baseUrl = this.runner.options.fhirOptions.stsfhirbaseurl;
|
|
2407
|
+
let stage = 1;
|
|
2408
|
+
const checkStatus = (stage, fr) => {
|
|
2409
|
+
if (fr.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
|
|
2410
|
+
return fr;
|
|
2411
|
+
};
|
|
2412
|
+
try {
|
|
2413
|
+
const retVal1 = checkStatus(stage++, await client.PostResource("Person", personRecord));
|
|
2414
|
+
const retVal2 = checkStatus(stage++, await client.GetResource("Person", personRecord.id));
|
|
2415
|
+
retVal2.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2416
|
+
const retVal3 = checkStatus(stage++, await client.PutResource("Person", retVal2.body, `W/"1"`));
|
|
2417
|
+
retVal3.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2418
|
+
const retVal4 = checkStatus(stage++, await client.PutResource("Person", retVal3.body, `W/"2"`));
|
|
2419
|
+
const url = new URL(`${baseUrl}/Person?family=${personRecord.name[0].family}`);
|
|
2420
|
+
checkStatus(stage++, await client.GetResources(url));
|
|
2421
|
+
const patchText1 = `Json Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2422
|
+
const observer = fast_json_patch_default.observe(retVal4.body);
|
|
2423
|
+
retVal4.body.text.div = patchText1;
|
|
2424
|
+
const patchRecord = fast_json_patch_default.generate(observer);
|
|
2425
|
+
const retVal6 = checkStatus(stage++, await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`));
|
|
2426
|
+
const patchText2 = `Merge Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2427
|
+
retVal6.body.text.div = patchText2;
|
|
2428
|
+
checkStatus(stage++, await client.PatchResource("Person", personRecord.id, retVal6.body, `application/merge-patch+json`, `W/"4"`));
|
|
2429
|
+
checkStatus(stage++, await client.DeleteResource("Person", personRecord.id, `W/"5"`));
|
|
2430
|
+
checkStatus(stage++, await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2"));
|
|
2431
|
+
return retVal1.body;
|
|
2432
|
+
} catch (error) {
|
|
2433
|
+
console.error(chalk.default.red(`TestCaseFhir20(): Stage: [${stage}], Error: [${error}]`));
|
|
2434
|
+
console.error(error);
|
|
2435
|
+
throw error;
|
|
2436
|
+
}
|
|
2437
|
+
};
|
|
2438
|
+
};
|
|
2439
|
+
//#endregion
|
|
2390
2440
|
//#region src/libmodule/testCase01.ts
|
|
2391
2441
|
/**
|
|
2392
2442
|
* Concrete synthetic test runner implementation.
|
|
@@ -3216,6 +3266,7 @@ var AsyncRunnerFactory = class {
|
|
|
3216
3266
|
case "TestCaseFhir08": return new TestCaseFhir08(runnerExecutionWorker, runner);
|
|
3217
3267
|
case "TestCaseFhir09": return new TestCaseFhir09(runnerExecutionWorker, runner);
|
|
3218
3268
|
case "TestCaseFhir10": return new TestCaseFhir10(runnerExecutionWorker, runner);
|
|
3269
|
+
case "TestCaseFhir20": return new TestCaseFhir20(runnerExecutionWorker, runner);
|
|
3219
3270
|
}
|
|
3220
3271
|
return null;
|
|
3221
3272
|
};
|
|
@@ -16814,6 +16865,7 @@ var WorkerFhirTestCases = class extends _nsshunt_stsrunnerframework.AbstractRunn
|
|
|
16814
16865
|
_id = crypto.randomUUID();
|
|
16815
16866
|
_clientHelper;
|
|
16816
16867
|
_authHelper;
|
|
16868
|
+
_maxIteration = {};
|
|
16817
16869
|
restFhirClient = null;
|
|
16818
16870
|
logPrefix = `WorkerFhirTestCases:[${this._id}]:`;
|
|
16819
16871
|
constructor(options) {
|
|
@@ -16928,6 +16980,12 @@ var WorkerFhirTestCases = class extends _nsshunt_stsrunnerframework.AbstractRunn
|
|
|
16928
16980
|
GetClient = async () => {
|
|
16929
16981
|
return this._clientHelper.GetClient();
|
|
16930
16982
|
};
|
|
16983
|
+
GetMaxIteration(key) {
|
|
16984
|
+
return this._maxIteration[key];
|
|
16985
|
+
}
|
|
16986
|
+
SetMaxIteration(key, maxIteration) {
|
|
16987
|
+
this._maxIteration[key] = maxIteration;
|
|
16988
|
+
}
|
|
16931
16989
|
};
|
|
16932
16990
|
//#endregion
|
|
16933
16991
|
exports.WorkerFhirTestCases = WorkerFhirTestCases;
|