@nsshunt/ststestrunner 1.1.156 → 1.1.158
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 +41 -0
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +41 -0
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +2 -2
- package/types/libmodule/asyncRunnerFactory.d.ts.map +1 -1
- package/types/libmodule/authHelperPureJS.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir20.d.ts +7 -0
- package/types/libmodule/testCaseFhir20.d.ts.map +1 -0
package/dist/ststestrunner.cjs
CHANGED
|
@@ -2387,6 +2387,46 @@ var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
|
2387
2387
|
};
|
|
2388
2388
|
};
|
|
2389
2389
|
//#endregion
|
|
2390
|
+
//#region src/libmodule/testCaseFhir20.ts
|
|
2391
|
+
var TestCaseFhir20 = class extends TestCaseFhirQueryBase {
|
|
2392
|
+
PerformExecuteQuery = async () => {
|
|
2393
|
+
const client = await this.GetClient();
|
|
2394
|
+
const prefix = this.runner.options.personPrefix;
|
|
2395
|
+
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
2396
|
+
const baseUrl = this.runner.options.fhirOptions.stsfhirbaseurl;
|
|
2397
|
+
let stage = 1;
|
|
2398
|
+
const checkStatus = (stage, fr) => {
|
|
2399
|
+
if (fr.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
|
|
2400
|
+
return fr;
|
|
2401
|
+
};
|
|
2402
|
+
try {
|
|
2403
|
+
const retVal1 = checkStatus(stage++, await client.PostResource("Person", personRecord));
|
|
2404
|
+
const retVal2 = checkStatus(stage++, await client.GetResource("Person", personRecord.id));
|
|
2405
|
+
retVal2.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2406
|
+
const retVal3 = checkStatus(stage++, await client.PutResource("Person", retVal2.body, `W/"1"`));
|
|
2407
|
+
retVal3.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2408
|
+
const retVal4 = checkStatus(stage++, await client.PutResource("Person", retVal3.body, `W/"2"`));
|
|
2409
|
+
const url = new URL(`${baseUrl}/Person?family=${personRecord.name[0].family}`);
|
|
2410
|
+
checkStatus(stage++, await client.GetResources(url));
|
|
2411
|
+
const patchText1 = `Json Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2412
|
+
const observer = fast_json_patch_default.observe(retVal4.body);
|
|
2413
|
+
retVal4.body.text.div = patchText1;
|
|
2414
|
+
const patchRecord = fast_json_patch_default.generate(observer);
|
|
2415
|
+
const retVal6 = checkStatus(stage++, await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`));
|
|
2416
|
+
const patchText2 = `Merge Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2417
|
+
retVal6.body.text.div = patchText2;
|
|
2418
|
+
checkStatus(stage++, await client.PatchResource("Person", personRecord.id, retVal6.body, `application/merge-patch+json`, `W/"4"`));
|
|
2419
|
+
checkStatus(stage++, await client.DeleteResource("Person", personRecord.id, `W/"5"`));
|
|
2420
|
+
checkStatus(stage++, await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2"));
|
|
2421
|
+
return retVal1.body;
|
|
2422
|
+
} catch (error) {
|
|
2423
|
+
console.error(chalk.default.red(`TestCaseFhir20(): Stage: [${stage}], Error: [${error}]`));
|
|
2424
|
+
console.error(error);
|
|
2425
|
+
throw error;
|
|
2426
|
+
}
|
|
2427
|
+
};
|
|
2428
|
+
};
|
|
2429
|
+
//#endregion
|
|
2390
2430
|
//#region src/libmodule/testCase01.ts
|
|
2391
2431
|
/**
|
|
2392
2432
|
* Concrete synthetic test runner implementation.
|
|
@@ -3216,6 +3256,7 @@ var AsyncRunnerFactory = class {
|
|
|
3216
3256
|
case "TestCaseFhir08": return new TestCaseFhir08(runnerExecutionWorker, runner);
|
|
3217
3257
|
case "TestCaseFhir09": return new TestCaseFhir09(runnerExecutionWorker, runner);
|
|
3218
3258
|
case "TestCaseFhir10": return new TestCaseFhir10(runnerExecutionWorker, runner);
|
|
3259
|
+
case "TestCaseFhir20": return new TestCaseFhir20(runnerExecutionWorker, runner);
|
|
3219
3260
|
}
|
|
3220
3261
|
return null;
|
|
3221
3262
|
};
|