@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.mjs
CHANGED
|
@@ -2382,6 +2382,46 @@ var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
|
2382
2382
|
};
|
|
2383
2383
|
};
|
|
2384
2384
|
//#endregion
|
|
2385
|
+
//#region src/libmodule/testCaseFhir20.ts
|
|
2386
|
+
var TestCaseFhir20 = class extends TestCaseFhirQueryBase {
|
|
2387
|
+
PerformExecuteQuery = async () => {
|
|
2388
|
+
const client = await this.GetClient();
|
|
2389
|
+
const prefix = this.runner.options.personPrefix;
|
|
2390
|
+
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
2391
|
+
const baseUrl = this.runner.options.fhirOptions.stsfhirbaseurl;
|
|
2392
|
+
let stage = 1;
|
|
2393
|
+
const checkStatus = (stage, fr) => {
|
|
2394
|
+
if (fr.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
|
|
2395
|
+
return fr;
|
|
2396
|
+
};
|
|
2397
|
+
try {
|
|
2398
|
+
const retVal1 = checkStatus(stage++, await client.PostResource("Person", personRecord));
|
|
2399
|
+
const retVal2 = checkStatus(stage++, await client.GetResource("Person", personRecord.id));
|
|
2400
|
+
retVal2.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2401
|
+
const retVal3 = checkStatus(stage++, await client.PutResource("Person", retVal2.body, `W/"1"`));
|
|
2402
|
+
retVal3.body.text.div = `Put record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2403
|
+
const retVal4 = checkStatus(stage++, await client.PutResource("Person", retVal3.body, `W/"2"`));
|
|
2404
|
+
const url = new URL(`${baseUrl}/Person?family=${personRecord.name[0].family}`);
|
|
2405
|
+
checkStatus(stage++, await client.GetResources(url));
|
|
2406
|
+
const patchText1 = `Json Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2407
|
+
const observer = fast_json_patch_default.observe(retVal4.body);
|
|
2408
|
+
retVal4.body.text.div = patchText1;
|
|
2409
|
+
const patchRecord = fast_json_patch_default.generate(observer);
|
|
2410
|
+
const retVal6 = checkStatus(stage++, await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`));
|
|
2411
|
+
const patchText2 = `Merge Patched record TestCaseFhir20 ${this.runner.iteration}`;
|
|
2412
|
+
retVal6.body.text.div = patchText2;
|
|
2413
|
+
checkStatus(stage++, await client.PatchResource("Person", personRecord.id, retVal6.body, `application/merge-patch+json`, `W/"4"`));
|
|
2414
|
+
checkStatus(stage++, await client.DeleteResource("Person", personRecord.id, `W/"5"`));
|
|
2415
|
+
checkStatus(stage++, await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2"));
|
|
2416
|
+
return retVal1.body;
|
|
2417
|
+
} catch (error) {
|
|
2418
|
+
console.error(chalk.red(`TestCaseFhir20(): Stage: [${stage}], Error: [${error}]`));
|
|
2419
|
+
console.error(error);
|
|
2420
|
+
throw error;
|
|
2421
|
+
}
|
|
2422
|
+
};
|
|
2423
|
+
};
|
|
2424
|
+
//#endregion
|
|
2385
2425
|
//#region src/libmodule/testCase01.ts
|
|
2386
2426
|
/**
|
|
2387
2427
|
* Concrete synthetic test runner implementation.
|
|
@@ -3211,6 +3251,7 @@ var AsyncRunnerFactory = class {
|
|
|
3211
3251
|
case "TestCaseFhir08": return new TestCaseFhir08(runnerExecutionWorker, runner);
|
|
3212
3252
|
case "TestCaseFhir09": return new TestCaseFhir09(runnerExecutionWorker, runner);
|
|
3213
3253
|
case "TestCaseFhir10": return new TestCaseFhir10(runnerExecutionWorker, runner);
|
|
3254
|
+
case "TestCaseFhir20": return new TestCaseFhir20(runnerExecutionWorker, runner);
|
|
3214
3255
|
}
|
|
3215
3256
|
return null;
|
|
3216
3257
|
};
|