@nsshunt/ststestrunner 1.1.144 → 1.1.146

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.
@@ -1449,18 +1449,23 @@ var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
1449
1449
  //#endregion
1450
1450
  //#region src/libmodule/testCaseFhir02.ts
1451
1451
  var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
1452
+ bundleBatch;
1453
+ personRecords = [];
1452
1454
  PerformExecuteQuery = async () => {
1453
1455
  const __snapshot1 = performance.now();
1454
1456
  const client = await this.GetClient();
1455
1457
  const __snapshot2 = this._CheckOutputLongDurationError(__snapshot1, "await this.GetClient()");
1456
1458
  const prefix = this.runner.options.personPrefix;
1457
- const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
1458
- const bundleBatch = {
1459
+ const bundleSize = this.runner.options.bundleSize;
1460
+ if (this.runner.iteration === 0) this.bundleBatch = {
1459
1461
  "resourceType": "Bundle",
1460
1462
  "type": "transaction",
1461
1463
  "entry": []
1462
1464
  };
1463
- bundleBatch.entry.push({
1465
+ const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
1466
+ const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1467
+ this.personRecords.push(personRecord);
1468
+ this.bundleBatch.entry.push({
1464
1469
  fullUrl: personRecord.id,
1465
1470
  resource: personRecord,
1466
1471
  request: {
@@ -1468,15 +1473,28 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
1468
1473
  url: "Person"
1469
1474
  }
1470
1475
  });
1471
- const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1472
- const retVal = await client.ProcessBatchOrTransactionResources(bundleBatch);
1473
- this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1474
- if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1475
- const retPersonData = { ...retVal.body.entry[0].resource };
1476
- delete personRecord.meta;
1477
- delete retPersonData.meta;
1478
- this.CheckReturnData(personRecord, retPersonData);
1479
- return retVal.body.entry[0].resource;
1476
+ let retVal = void 0;
1477
+ if (this.runner.iteration % bundleSize === bundleSize - 1) {
1478
+ retVal = await client.ProcessBatchOrTransactionResources(this.bundleBatch);
1479
+ this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1480
+ this.bundleBatch.entry = [];
1481
+ } else if (this.runner.iteration === this.runner.options.executionProfile.iterations - 1) {
1482
+ retVal = await client.ProcessBatchOrTransactionResources(this.bundleBatch);
1483
+ this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1484
+ this.bundleBatch.entry = [];
1485
+ }
1486
+ if (retVal && retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1487
+ if (retVal) {
1488
+ for (let i = 0; i < retVal.body.entry.length - 1; i++) {
1489
+ const personRecord = this.personRecords[i];
1490
+ delete personRecord.meta;
1491
+ const retPersonData = { ...retVal.body.entry[i].resource };
1492
+ delete retPersonData.meta;
1493
+ this.CheckReturnData(personRecord, retPersonData);
1494
+ }
1495
+ this.personRecords = [];
1496
+ }
1497
+ return personRecord;
1480
1498
  };
1481
1499
  };
1482
1500
  //#endregion