Skip to content

Commit e944d7d

Browse files
author
Rishabh
committed
fixes querier tests
1 parent 1eaa5e3 commit e944d7d

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

test/querier.test.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,14 @@ describe(`Querier: ${printPath("[test/querier.test.js]")}`, function () {
279279
setKeyValueInConfig("base_path", "/test");
280280
await startST();
281281

282-
let response = await axios.get("http://localhost:8080/test/hello");
283-
if (response.status === 404) {
284-
//core must be an older version, so we return early
285-
return;
286-
} else if (response.status !== 200) {
287-
throw new Error("test failed");
282+
try {
283+
await axios.get("http://localhost:8080/test/hello");
284+
} catch (error) {
285+
if (error.response.status === 404) {
286+
//core must be an older version, so we return early
287+
return;
288+
}
289+
throw error;
288290
}
289291

290292
ST.init({
@@ -309,12 +311,14 @@ describe(`Querier: ${printPath("[test/querier.test.js]")}`, function () {
309311
setKeyValueInConfig("base_path", "/some/path");
310312
await startST();
311313

312-
let response = await axios.get("http://localhost:8080/some/path/hello");
313-
if (response.status === 404) {
314-
//core must be an older version, so we return early
315-
return;
316-
} else if (response.status !== 200) {
317-
throw new Error("test failed");
314+
try {
315+
await axios.get("http://localhost:8080/some/path/hello");
316+
} catch (error) {
317+
if (error.response.status === 404) {
318+
//core must be an older version, so we return early
319+
return;
320+
}
321+
throw error;
318322
}
319323

320324
ST.init({
@@ -346,12 +350,14 @@ describe(`Querier: ${printPath("[test/querier.test.js]")}`, function () {
346350
setKeyValueInConfig("base_path", "/test");
347351
await startST("localhost", 8082);
348352

349-
let response = await axios.get("http://localhost:8080/some/path/hello");
350-
if (response.status === 404) {
351-
//core must be an older version, so we return early
352-
return;
353-
} else if (response.status !== 200) {
354-
throw new Error("test failed");
353+
try {
354+
await axios.get("http://localhost:8080/some/path/hello");
355+
} catch (error) {
356+
if (error.response.status === 404) {
357+
//core must be an older version, so we return early
358+
return;
359+
}
360+
throw error;
355361
}
356362

357363
ST.init({

0 commit comments

Comments
 (0)