@nsshunt/ststestrunner 1.1.94 → 1.1.96

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.
@@ -743,6 +743,11 @@ var TestCaseFhirBase = class {
743
743
  return true;
744
744
  }
745
745
  } else this.Error(chalk.red(`TestCaseFhirBase:HandleError(): AXIOS Error = [${axiosError}]`));
746
+ } else if (error.message === "UNAUTHORIZED") {
747
+ this.runner.instrumentData.authenticationErrorCount++;
748
+ this.Error(chalk.red(`TestCaseFhirBase:HandleError(): UNAUTHORIZED - Reset Access Token`));
749
+ this.ResetAccessToken();
750
+ return true;
746
751
  }
747
752
  return false;
748
753
  };
@@ -1053,6 +1058,7 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
1053
1058
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1054
1059
  const retVal = await client.PostResource("Person", personRecord);
1055
1060
  this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1061
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1056
1062
  delete personRecord.meta;
1057
1063
  delete retVal.body.meta;
1058
1064
  const p1 = JSON.stringify(personRecord);
@@ -1082,6 +1088,7 @@ var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
1082
1088
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1083
1089
  const retVal = await client.GetResource("Person", personRecord.id);
1084
1090
  this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1091
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1085
1092
  delete personRecord.meta;
1086
1093
  delete retVal.body.meta;
1087
1094
  const p1 = JSON.stringify(personRecord);
@@ -1111,6 +1118,7 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
1111
1118
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1112
1119
  const retVal = await client.GetResource("Person", personRecord.id);
1113
1120
  const __snapshot4 = this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1121
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1114
1122
  this.runner.instrumentData.requestCount++;
1115
1123
  const compPersonRecord = { ...personRecord };
1116
1124
  const loadedPersonRecorded = { ...retVal.body };
@@ -1135,6 +1143,7 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
1135
1143
  originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
1136
1144
  const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
1137
1145
  this._CheckOutputLongDurationError(__snapshot4, "await this.PutResource()");
1146
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1138
1147
  const updatedRecord = { ...retVal.body };
1139
1148
  delete updatedRecord.meta;
1140
1149
  delete originalPersonRecord.meta;
@@ -1171,6 +1180,7 @@ var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
1171
1180
  originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
1172
1181
  const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
1173
1182
  this._CheckOutputLongDurationError(__snapshot3, "await this.PutResource()");
1183
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1174
1184
  const updatedRecord = { ...retVal.body };
1175
1185
  delete updatedRecord.meta;
1176
1186
  delete originalPersonRecord.meta;
@@ -1214,9 +1224,11 @@ var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
1214
1224
  };
1215
1225
  retVal = await client.GenericSearchTesting("Person", data);
1216
1226
  this._CheckOutputLongDurationError(__snapshot3, "await this.GenericSearchTesting()");
1227
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1217
1228
  } else {
1218
1229
  retVal = await client.GetResources(url);
1219
1230
  this._CheckOutputLongDurationError(__snapshot3, "await this.GetResources()");
1231
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1220
1232
  }
1221
1233
  return retVal.body;
1222
1234
  };
@@ -1879,12 +1891,14 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
1879
1891
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1880
1892
  const retVal = await client.GetResource("Person", personRecord.id);
1881
1893
  const __snapshot4 = this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1894
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1882
1895
  const resource = retVal.body;
1883
1896
  const observer = fast_json_patch_default.observe(resource);
1884
1897
  resource.text.div = `Json Patched record TestCaseFhir07 ${this.runner.iteration}`;
1885
1898
  const patchRecord = fast_json_patch_default.generate(observer);
1886
1899
  const retValPatched = await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`);
1887
1900
  this._CheckOutputLongDurationError(__snapshot4, "await this.PatchResource()");
1901
+ if (retValPatched.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1888
1902
  return retValPatched.body;
1889
1903
  };
1890
1904
  };
@@ -1899,10 +1913,12 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
1899
1913
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1900
1914
  const retVal = await client.GetResource("Person", personRecord.id);
1901
1915
  const __snapshot4 = this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1916
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1902
1917
  const resource = retVal.body;
1903
1918
  resource.text.div = `Merge Patched record TestCaseFhir08 ${this.runner.iteration}`;
1904
1919
  const retValPatched = await client.PatchResource("Person", personRecord.id, resource, `application/merge-patch+json`, `W/"4"`);
1905
1920
  this._CheckOutputLongDurationError(__snapshot4, "await this.PatchResource()");
1921
+ if (retValPatched.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1906
1922
  return retValPatched.body;
1907
1923
  };
1908
1924
  };
@@ -1918,6 +1934,7 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
1918
1934
  if (personRecord.text) try {
1919
1935
  const retVal = await client.DeleteResource("Person", personRecord.id, `W/"5"`);
1920
1936
  this._CheckOutputLongDurationError(__snapshot3, "await this.DeleteResource()");
1937
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1921
1938
  return retVal.body;
1922
1939
  } catch (error) {
1923
1940
  if (axios.isAxiosError(error)) {
@@ -1945,6 +1962,7 @@ var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
1945
1962
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1946
1963
  const retVal = await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2");
1947
1964
  this._CheckOutputLongDurationError(__snapshot3, "await this.GetHistoryInstanceFhirResource()");
1965
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1948
1966
  return retVal.body;
1949
1967
  };
1950
1968
  };