@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.
@@ -767,6 +767,11 @@ var TestCaseFhirBase = class {
767
767
  return true;
768
768
  }
769
769
  } else this.Error(chalk.default.red(`TestCaseFhirBase:HandleError(): AXIOS Error = [${axiosError}]`));
770
+ } else if (error.message === "UNAUTHORIZED") {
771
+ this.runner.instrumentData.authenticationErrorCount++;
772
+ this.Error(chalk.default.red(`TestCaseFhirBase:HandleError(): UNAUTHORIZED - Reset Access Token`));
773
+ this.ResetAccessToken();
774
+ return true;
770
775
  }
771
776
  return false;
772
777
  };
@@ -1077,6 +1082,7 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
1077
1082
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1078
1083
  const retVal = await client.PostResource("Person", personRecord);
1079
1084
  this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1085
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1080
1086
  delete personRecord.meta;
1081
1087
  delete retVal.body.meta;
1082
1088
  const p1 = JSON.stringify(personRecord);
@@ -1106,6 +1112,7 @@ var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
1106
1112
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1107
1113
  const retVal = await client.GetResource("Person", personRecord.id);
1108
1114
  this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1115
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1109
1116
  delete personRecord.meta;
1110
1117
  delete retVal.body.meta;
1111
1118
  const p1 = JSON.stringify(personRecord);
@@ -1135,6 +1142,7 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
1135
1142
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1136
1143
  const retVal = await client.GetResource("Person", personRecord.id);
1137
1144
  const __snapshot4 = this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1145
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1138
1146
  this.runner.instrumentData.requestCount++;
1139
1147
  const compPersonRecord = { ...personRecord };
1140
1148
  const loadedPersonRecorded = { ...retVal.body };
@@ -1159,6 +1167,7 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
1159
1167
  originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
1160
1168
  const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
1161
1169
  this._CheckOutputLongDurationError(__snapshot4, "await this.PutResource()");
1170
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1162
1171
  const updatedRecord = { ...retVal.body };
1163
1172
  delete updatedRecord.meta;
1164
1173
  delete originalPersonRecord.meta;
@@ -1195,6 +1204,7 @@ var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
1195
1204
  originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
1196
1205
  const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
1197
1206
  this._CheckOutputLongDurationError(__snapshot3, "await this.PutResource()");
1207
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1198
1208
  const updatedRecord = { ...retVal.body };
1199
1209
  delete updatedRecord.meta;
1200
1210
  delete originalPersonRecord.meta;
@@ -1238,9 +1248,11 @@ var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
1238
1248
  };
1239
1249
  retVal = await client.GenericSearchTesting("Person", data);
1240
1250
  this._CheckOutputLongDurationError(__snapshot3, "await this.GenericSearchTesting()");
1251
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1241
1252
  } else {
1242
1253
  retVal = await client.GetResources(url);
1243
1254
  this._CheckOutputLongDurationError(__snapshot3, "await this.GetResources()");
1255
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1244
1256
  }
1245
1257
  return retVal.body;
1246
1258
  };
@@ -1903,12 +1915,14 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
1903
1915
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1904
1916
  const retVal = await client.GetResource("Person", personRecord.id);
1905
1917
  const __snapshot4 = this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1918
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1906
1919
  const resource = retVal.body;
1907
1920
  const observer = fast_json_patch_default.observe(resource);
1908
1921
  resource.text.div = `Json Patched record TestCaseFhir07 ${this.runner.iteration}`;
1909
1922
  const patchRecord = fast_json_patch_default.generate(observer);
1910
1923
  const retValPatched = await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`);
1911
1924
  this._CheckOutputLongDurationError(__snapshot4, "await this.PatchResource()");
1925
+ if (retValPatched.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1912
1926
  return retValPatched.body;
1913
1927
  };
1914
1928
  };
@@ -1923,10 +1937,12 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
1923
1937
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1924
1938
  const retVal = await client.GetResource("Person", personRecord.id);
1925
1939
  const __snapshot4 = this._CheckOutputLongDurationError(__snapshot3, "await this.GetResource()");
1940
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1926
1941
  const resource = retVal.body;
1927
1942
  resource.text.div = `Merge Patched record TestCaseFhir08 ${this.runner.iteration}`;
1928
1943
  const retValPatched = await client.PatchResource("Person", personRecord.id, resource, `application/merge-patch+json`, `W/"4"`);
1929
1944
  this._CheckOutputLongDurationError(__snapshot4, "await this.PatchResource()");
1945
+ if (retValPatched.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1930
1946
  return retValPatched.body;
1931
1947
  };
1932
1948
  };
@@ -1942,6 +1958,7 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
1942
1958
  if (personRecord.text) try {
1943
1959
  const retVal = await client.DeleteResource("Person", personRecord.id, `W/"5"`);
1944
1960
  this._CheckOutputLongDurationError(__snapshot3, "await this.DeleteResource()");
1961
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1945
1962
  return retVal.body;
1946
1963
  } catch (error) {
1947
1964
  if (axios.default.isAxiosError(error)) {
@@ -1969,6 +1986,7 @@ var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
1969
1986
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1970
1987
  const retVal = await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2");
1971
1988
  this._CheckOutputLongDurationError(__snapshot3, "await this.GetHistoryInstanceFhirResource()");
1989
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1972
1990
  return retVal.body;
1973
1991
  };
1974
1992
  };