@nsshunt/ststestrunner 1.1.45 → 1.1.46

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.
@@ -483,7 +483,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
483
483
  }
484
484
  };
485
485
  ExecuteRunner = async () => {
486
- if (this.runner.iteration % 100 === 0) this.Debug(`${this.runner.options.testType}:${this.runner.workerManagerId} -->> Iteration: ${this.runner.options.description} ${this.runner.iteration}`);
486
+ if (this.runner.iteration % 100 === 0) this.Debug(`TestCaseFhirQueryBase:ExecuteRunner(): ${this.runner.options.testType}:${this.runner.workerManagerId} -->> Iteration: ${this.runner.options.description} ${this.runner.iteration}`);
487
487
  const start = performance.now();
488
488
  this.runner.instrumentData.activeRequestCount++;
489
489
  this.#CheckResetClient();
@@ -501,7 +501,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
501
501
  this.runner.instrumentData.activeRequestCount--;
502
502
  const diff = performance.now() - start;
503
503
  this.runner.instrumentData.duration = diff;
504
- if (diff > 150) console.debug(chalk.magenta(`*** ==> Long execution: [${diff}]`));
504
+ if (diff > 150) this.Debug(chalk.magenta(`TestCaseFhirQueryBase:ExecuteRunner(): *** ==> Long execution: [${diff}]`));
505
505
  await this.PublishTelemetry();
506
506
  return true;
507
507
  };
@@ -510,9 +510,15 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
510
510
  //#region src/libmodule/testCaseFhir01.ts
511
511
  var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
512
512
  ExecuteQuery = async () => {
513
- await this.GetAccessToken();
514
- this.accesssToken = null;
515
- return null;
513
+ try {
514
+ await this.GetAccessToken();
515
+ this.accesssToken = null;
516
+ return null;
517
+ } catch (error) {
518
+ this.runner.instrumentData.errorCount++;
519
+ this.Error(`TestCaseFhir01:ExecuteQuery(): Error: [${error}]`);
520
+ throw error;
521
+ }
516
522
  };
517
523
  };
518
524
  //#endregion
@@ -525,8 +531,9 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
525
531
  const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
526
532
  return (await client.PostResource("Person", personRecord)).body;
527
533
  } catch (error) {
528
- console.error(error);
529
- return null;
534
+ this.runner.instrumentData.errorCount++;
535
+ this.Error(`TestCaseFhir02:ExecuteQuery(): Error: [${error}]`);
536
+ throw error;
530
537
  }
531
538
  };
532
539
  };
@@ -534,49 +541,61 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
534
541
  //#region src/libmodule/testCaseFhir03.ts
535
542
  var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
536
543
  ExecuteQuery = async () => {
537
- const client = await this.GetClient();
538
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
539
- const retVal = await client.GetResource("Person", personRecord.id);
540
- delete personRecord.meta;
541
- delete retVal.body.meta;
542
- const p1 = JSON.stringify(personRecord);
543
- const p2 = JSON.stringify(retVal.body);
544
- if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
545
- return retVal.body;
544
+ try {
545
+ const client = await this.GetClient();
546
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
547
+ const retVal = await client.GetResource("Person", personRecord.id);
548
+ delete personRecord.meta;
549
+ delete retVal.body.meta;
550
+ const p1 = JSON.stringify(personRecord);
551
+ const p2 = JSON.stringify(retVal.body);
552
+ if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
553
+ return retVal.body;
554
+ } catch (error) {
555
+ this.runner.instrumentData.errorCount++;
556
+ this.Error(`TestCaseFhir03:ExecuteQuery(): Error: [${error}]`);
557
+ throw error;
558
+ }
546
559
  };
547
560
  };
548
561
  //#endregion
549
562
  //#region src/libmodule/testCaseFhir04.ts
550
563
  var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
551
564
  ExecuteQuery = async () => {
552
- const client = await this.GetClient();
553
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
554
- const retVal = await client.GetResource("Person", personRecord.id);
555
- this.runner.instrumentData.requestCount++;
556
- const compPersonRecord = { ...personRecord };
557
- const loadedPersonRecorded = { ...retVal.body };
558
- delete compPersonRecord.meta;
559
- delete loadedPersonRecorded.meta;
560
- const p1 = JSON.stringify(compPersonRecord);
561
- const p2 = JSON.stringify(loadedPersonRecorded);
562
- if (p1.localeCompare(p2) !== 0) {
563
- this.runner.instrumentData.errorCount++;
564
- return retVal.body;
565
- }
566
- const originalPersonRecord = retVal.body;
567
- if (originalPersonRecord && originalPersonRecord.text) {
568
- originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
569
- const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
570
- const updatedRecord = { ...retVal.body };
571
- delete updatedRecord.meta;
572
- delete originalPersonRecord.meta;
573
- const p1 = JSON.stringify(updatedRecord);
574
- const p2 = JSON.stringify(originalPersonRecord);
575
- if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
576
- return retVal.body;
577
- } else {
565
+ try {
566
+ const client = await this.GetClient();
567
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
568
+ const retVal = await client.GetResource("Person", personRecord.id);
569
+ this.runner.instrumentData.requestCount++;
570
+ const compPersonRecord = { ...personRecord };
571
+ const loadedPersonRecorded = { ...retVal.body };
572
+ delete compPersonRecord.meta;
573
+ delete loadedPersonRecorded.meta;
574
+ const p1 = JSON.stringify(compPersonRecord);
575
+ const p2 = JSON.stringify(loadedPersonRecorded);
576
+ if (p1.localeCompare(p2) !== 0) {
577
+ this.runner.instrumentData.errorCount++;
578
+ return retVal.body;
579
+ }
580
+ const originalPersonRecord = retVal.body;
581
+ if (originalPersonRecord && originalPersonRecord.text) {
582
+ originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
583
+ const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
584
+ const updatedRecord = { ...retVal.body };
585
+ delete updatedRecord.meta;
586
+ delete originalPersonRecord.meta;
587
+ const p1 = JSON.stringify(updatedRecord);
588
+ const p2 = JSON.stringify(originalPersonRecord);
589
+ if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
590
+ return retVal.body;
591
+ } else {
592
+ this.runner.instrumentData.errorCount++;
593
+ return null;
594
+ }
595
+ } catch (error) {
578
596
  this.runner.instrumentData.errorCount++;
579
- return null;
597
+ this.Error(`TestCaseFhir04:ExecuteQuery(): Error: [${error}]`);
598
+ throw error;
580
599
  }
581
600
  };
582
601
  };
@@ -584,21 +603,27 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
584
603
  //#region src/libmodule/testCaseFhir05.ts
585
604
  var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
586
605
  ExecuteQuery = async () => {
587
- const client = await this.GetClient();
588
- const originalPersonRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "2");
589
- if (originalPersonRecord && originalPersonRecord.text) {
590
- originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
591
- const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
592
- const updatedRecord = { ...retVal.body };
593
- delete updatedRecord.meta;
594
- delete originalPersonRecord.meta;
595
- const p1 = JSON.stringify(updatedRecord);
596
- const p2 = JSON.stringify(originalPersonRecord);
597
- if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
598
- return retVal.body;
599
- } else {
606
+ try {
607
+ const client = await this.GetClient();
608
+ const originalPersonRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "2");
609
+ if (originalPersonRecord && originalPersonRecord.text) {
610
+ originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
611
+ const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
612
+ const updatedRecord = { ...retVal.body };
613
+ delete updatedRecord.meta;
614
+ delete originalPersonRecord.meta;
615
+ const p1 = JSON.stringify(updatedRecord);
616
+ const p2 = JSON.stringify(originalPersonRecord);
617
+ if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
618
+ return retVal.body;
619
+ } else {
620
+ this.runner.instrumentData.errorCount++;
621
+ return null;
622
+ }
623
+ } catch (error) {
600
624
  this.runner.instrumentData.errorCount++;
601
- return null;
625
+ this.Error(`TestCaseFhir05:ExecuteQuery(): Error: [${error}]`);
626
+ throw error;
602
627
  }
603
628
  };
604
629
  };
@@ -625,7 +650,8 @@ var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
625
650
  return retVal.body;
626
651
  } catch (error) {
627
652
  this.runner.instrumentData.errorCount++;
628
- return null;
653
+ this.Error(`TestCaseFhir06:ExecuteQuery(): Error: [${error}]`);
654
+ throw error;
629
655
  }
630
656
  };
631
657
  };
@@ -1289,7 +1315,8 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
1289
1315
  const patchRecord = fast_json_patch_default.generate(observer);
1290
1316
  return (await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`)).body;
1291
1317
  } catch (error) {
1292
- console.error(error);
1318
+ this.runner.instrumentData.errorCount++;
1319
+ this.Error(`TestCaseFhir07:ExecuteQuery(): Error: [${error}]`);
1293
1320
  throw error;
1294
1321
  }
1295
1322
  };
@@ -1305,7 +1332,8 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
1305
1332
  resource.text.div = `Merge Patched record TestCaseFhir08 ${this.runner.iteration}`;
1306
1333
  return (await client.PatchResource("Person", personRecord.id, resource, `application/merge-patch+json`, `W/"4"`)).body;
1307
1334
  } catch (error) {
1308
- console.error(error);
1335
+ this.runner.instrumentData.errorCount++;
1336
+ this.Error(`TestCaseFhir08:ExecuteQuery(): Error: [${error}]`);
1309
1337
  throw error;
1310
1338
  }
1311
1339
  };
@@ -1314,12 +1342,18 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
1314
1342
  //#region src/libmodule/testCaseFhir09.ts
1315
1343
  var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
1316
1344
  ExecuteQuery = async () => {
1317
- const client = await this.GetClient();
1318
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "5");
1319
- if (personRecord.text) return (await client.DeleteResource("Person", personRecord.id, `W/"5"`)).body;
1320
- else {
1345
+ try {
1346
+ const client = await this.GetClient();
1347
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "5");
1348
+ if (personRecord.text) return (await client.DeleteResource("Person", personRecord.id, `W/"5"`)).body;
1349
+ else {
1350
+ this.runner.instrumentData.errorCount++;
1351
+ return null;
1352
+ }
1353
+ } catch (error) {
1321
1354
  this.runner.instrumentData.errorCount++;
1322
- return null;
1355
+ this.Error(`TestCaseFhir09:ExecuteQuery(): Error: [${error}]`);
1356
+ throw error;
1323
1357
  }
1324
1358
  };
1325
1359
  };
@@ -1327,9 +1361,15 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
1327
1361
  //#region src/libmodule/testCaseFhir10.ts
1328
1362
  var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
1329
1363
  ExecuteQuery = async () => {
1330
- const client = await this.GetClient();
1331
- const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
1332
- return (await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2")).body;
1364
+ try {
1365
+ const client = await this.GetClient();
1366
+ const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
1367
+ return (await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2")).body;
1368
+ } catch (error) {
1369
+ this.runner.instrumentData.errorCount++;
1370
+ this.Error(`TestCaseFhir10:ExecuteQuery(): Error: [${error}]`);
1371
+ throw error;
1372
+ }
1333
1373
  };
1334
1374
  };
1335
1375
  //#endregion