@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.mjs
CHANGED
|
@@ -999,14 +999,22 @@ var TestCaseFhirBase = class {
|
|
|
999
999
|
get runnerExecutionWorker() {
|
|
1000
1000
|
return this.#runnerExecutionWorker;
|
|
1001
1001
|
}
|
|
1002
|
+
GetMaxIteration(key) {
|
|
1003
|
+
return this.runnerExecutionWorker.GetMaxIteration(key);
|
|
1004
|
+
}
|
|
1005
|
+
SetMaxIteration(key, maxIteration) {
|
|
1006
|
+
this.runnerExecutionWorker.SetMaxIteration(key, maxIteration);
|
|
1007
|
+
}
|
|
1002
1008
|
ResetClient = () => {};
|
|
1003
1009
|
GetRandomSequenceFromIteration = () => {
|
|
1010
|
+
const prefix = this.runner.options.personPrefix;
|
|
1011
|
+
const maxIterations = this.GetMaxIteration(prefix);
|
|
1004
1012
|
if (this.runner.iteration === 0) {
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1007
|
-
this.randomSequence = getRandomIterationOrder(this.runner.options.executionProfile.iterations, seedId);
|
|
1013
|
+
const seedId = prefix;
|
|
1014
|
+
this.randomSequence = getRandomIterationOrder(maxIterations, seedId);
|
|
1008
1015
|
}
|
|
1009
|
-
|
|
1016
|
+
const useIteration = this.runner.iteration % maxIterations;
|
|
1017
|
+
return this.randomSequence[useIteration];
|
|
1010
1018
|
};
|
|
1011
1019
|
Error = (message) => {
|
|
1012
1020
|
this.#runnerExecutionWorker.logger.error(message);
|
|
@@ -1466,6 +1474,7 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
1466
1474
|
"entry": []
|
|
1467
1475
|
};
|
|
1468
1476
|
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
1477
|
+
this.SetMaxIteration(prefix, this.runner.iteration);
|
|
1469
1478
|
const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
|
|
1470
1479
|
const foundIndexPersonRecords = this.personRecords.findIndex((p) => p.id?.localeCompare(personRecord.id) === 0);
|
|
1471
1480
|
const foundIndexBindlePersonRecords = this.bundleBatch.entry.findIndex((p) => p.resource.id?.localeCompare(personRecord.id) === 0);
|
|
@@ -1511,7 +1520,8 @@ var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
|
|
|
1511
1520
|
const __snapshot1 = performance.now();
|
|
1512
1521
|
const client = await this.GetClient();
|
|
1513
1522
|
const __snapshot2 = this._CheckOutputLongDurationError(__snapshot1, "await this.GetClient()");
|
|
1514
|
-
const
|
|
1523
|
+
const prefix = this.runner.options.personPrefix;
|
|
1524
|
+
const personRecord = await this.GetPersonRecord(prefix, this.GetRandomSequenceFromIteration(), "1");
|
|
1515
1525
|
const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
|
|
1516
1526
|
const retVal = await client.GetResource("Person", personRecord.id);
|
|
1517
1527
|
this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
|
|
@@ -2382,6 +2392,46 @@ var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
|
2382
2392
|
};
|
|
2383
2393
|
};
|
|
2384
2394
|
//#endregion
|
|
2395
|
+
//#region src/libmodule/testCaseFhir20.ts
|
|
2396
|
+
var TestCaseFhir20 = class extends TestCaseFhirQueryBase {
|
|
2397
|
+
PerformExecuteQuery = async () => {
|
|
2398
|
+
const client = await this.GetClient();
|
|
2399
|
+
const prefix = this.runner.options.personPrefix;
|
|
2400
|
+
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
2401
|
+
const baseUrl = this.runner.options.fhirOptions.stsfhirbaseurl;
|
|
2402
|
+
let stage = 1;
|
|
2403
|
+
const checkStatus = (stage, fr) => {
|
|
2404
|
+
if (fr.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
|
|
2405
|
+
return fr;
|
|
2406
|
+
};
|
|
2407
|
+
try {
|
|
2408
|
+
const retVal1 = checkStatus(stage++, await client.PostResource("Person", personRecord));
|
|
2409
|
+
const retVal2 = checkStatus(stage++, await client.GetResource("Person", personRecord.id));
|
|
2410
|
+
retVal2.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2411
|
+
const retVal3 = checkStatus(stage++, await client.PutResource("Person", retVal2.body, `W/"1"`));
|
|
2412
|
+
retVal3.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2413
|
+
const retVal4 = checkStatus(stage++, await client.PutResource("Person", retVal3.body, `W/"2"`));
|
|
2414
|
+
const url = new URL(`${baseUrl}/Person?family=${personRecord.name[0].family}`);
|
|
2415
|
+
checkStatus(stage++, await client.GetResources(url));
|
|
2416
|
+
const patchText1 = `Json Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2417
|
+
const observer = fast_json_patch_default.observe(retVal4.body);
|
|
2418
|
+
retVal4.body.text.div = patchText1;
|
|
2419
|
+
const patchRecord = fast_json_patch_default.generate(observer);
|
|
2420
|
+
const retVal6 = checkStatus(stage++, await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`));
|
|
2421
|
+
const patchText2 = `Merge Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2422
|
+
retVal6.body.text.div = patchText2;
|
|
2423
|
+
checkStatus(stage++, await client.PatchResource("Person", personRecord.id, retVal6.body, `application/merge-patch+json`, `W/"4"`));
|
|
2424
|
+
checkStatus(stage++, await client.DeleteResource("Person", personRecord.id, `W/"5"`));
|
|
2425
|
+
checkStatus(stage++, await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2"));
|
|
2426
|
+
return retVal1.body;
|
|
2427
|
+
} catch (error) {
|
|
2428
|
+
console.error(chalk.red(`TestCaseFhir20(): Stage: [${stage}], Error: [${error}]`));
|
|
2429
|
+
console.error(error);
|
|
2430
|
+
throw error;
|
|
2431
|
+
}
|
|
2432
|
+
};
|
|
2433
|
+
};
|
|
2434
|
+
//#endregion
|
|
2385
2435
|
//#region src/libmodule/testCase01.ts
|
|
2386
2436
|
/**
|
|
2387
2437
|
* Concrete synthetic test runner implementation.
|
|
@@ -3211,6 +3261,7 @@ var AsyncRunnerFactory = class {
|
|
|
3211
3261
|
case "TestCaseFhir08": return new TestCaseFhir08(runnerExecutionWorker, runner);
|
|
3212
3262
|
case "TestCaseFhir09": return new TestCaseFhir09(runnerExecutionWorker, runner);
|
|
3213
3263
|
case "TestCaseFhir10": return new TestCaseFhir10(runnerExecutionWorker, runner);
|
|
3264
|
+
case "TestCaseFhir20": return new TestCaseFhir20(runnerExecutionWorker, runner);
|
|
3214
3265
|
}
|
|
3215
3266
|
return null;
|
|
3216
3267
|
};
|
|
@@ -16809,6 +16860,7 @@ var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
|
|
|
16809
16860
|
_id = crypto.randomUUID();
|
|
16810
16861
|
_clientHelper;
|
|
16811
16862
|
_authHelper;
|
|
16863
|
+
_maxIteration = {};
|
|
16812
16864
|
restFhirClient = null;
|
|
16813
16865
|
logPrefix = `WorkerFhirTestCases:[${this._id}]:`;
|
|
16814
16866
|
constructor(options) {
|
|
@@ -16923,6 +16975,12 @@ var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
|
|
|
16923
16975
|
GetClient = async () => {
|
|
16924
16976
|
return this._clientHelper.GetClient();
|
|
16925
16977
|
};
|
|
16978
|
+
GetMaxIteration(key) {
|
|
16979
|
+
return this._maxIteration[key];
|
|
16980
|
+
}
|
|
16981
|
+
SetMaxIteration(key, maxIteration) {
|
|
16982
|
+
this._maxIteration[key] = maxIteration;
|
|
16983
|
+
}
|
|
16926
16984
|
};
|
|
16927
16985
|
//#endregion
|
|
16928
16986
|
export { WorkerFhirTestCases };
|