Skip to content

Commit

Permalink
Merge branch 'main' of github.com:agrostar/zzapi
Browse files Browse the repository at this point in the history
  • Loading branch information
vasan-agrostar committed Jun 2, 2024
2 parents 76c1e09 + 5979a2b commit 54aafbc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/mergeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ function mergePrefixBasedTests(tests: RawTests) {
for (const key of Object.keys(tests)) {
if (key.startsWith("$.")) {
tests.json[key] = tests[key];
delete tests[key];
} else if (key.startsWith("$h.")) {
const headerName = key.replace(/^\$h\./, "");
tests.headers[headerName] = tests[key];
delete tests[key];
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ export function runAllTests(
const results: TestResult[] = [];
if (!tests) return results;

let statusFail = false;
if (tests.status) {
const expected = tests.status;
const received = responseData.status;
const statusResults = runTest("status", expected, received);
results.push(...statusResults);
statusFail = statusResults.some((r) => !r.pass);

if (stopOnFailure && statusResults.some((r) => !r.pass)) return results;
}
if (stopOnFailure && statusFail) return results;

for (const spec in tests.headers) {
const expected = tests.headers[spec];
Expand Down

0 comments on commit 54aafbc

Please sign in to comment.