test: harden HTTP scenario execution evidence
This commit is contained in:
@@ -80,6 +80,26 @@ export const httpScenarioAssertionGroupsSchema = z
|
||||
if (groups.retry.count !== groups.retry.reasons.length) {
|
||||
fail(["retry", "count"], "must equal retry reasons length");
|
||||
}
|
||||
if (groups.retry.count !== groups.fetch.count - 1) {
|
||||
fail(["retry", "count"], "must equal the non-final fetch attempt count");
|
||||
}
|
||||
for (const [index, reason] of groups.retry.reasons.entries()) {
|
||||
const status = groups.status.attempts[index];
|
||||
const expectedReason =
|
||||
status === "NETWORK_REJECTION"
|
||||
? "NETWORK_FAILURE"
|
||||
: status === 429
|
||||
? "HTTP_429"
|
||||
: status === 503
|
||||
? "HTTP_503"
|
||||
: null;
|
||||
if (reason !== expectedReason) {
|
||||
fail(
|
||||
["retry", "reasons", index],
|
||||
"must match the corresponding non-final attempt status",
|
||||
);
|
||||
}
|
||||
}
|
||||
if (groups.fetch.count !== groups.status.attempts.length) {
|
||||
fail(["fetch", "count"], "must equal status attempts length");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user