Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -14,7 +14,7 @@ test("Импорт: не больше двух разборов сразу, ли
|
||||
active--;
|
||||
});
|
||||
const running = [task(), task(), task()];
|
||||
await assert.rejects(task(), (e) => e.status === 429 && e.message === "Занято");
|
||||
await assert.rejects(task(), (e) => e.status === 429 && e.code === "busy" && e.message === "Занято");
|
||||
// Each finished task hands its slot to the one waiting.
|
||||
while (release.length) {
|
||||
release.shift()();
|
||||
@@ -47,6 +47,10 @@ test("Импорт: лимит запросов считается по адре
|
||||
};
|
||||
assert.ok(call("10.0.0.1").passed);
|
||||
assert.ok(call("10.0.0.1").passed);
|
||||
assert.deepEqual(call("10.0.0.1"), { status: 429, body: { error: "Подождите" }, passed: false });
|
||||
assert.deepEqual(call("10.0.0.1"), {
|
||||
status: 429,
|
||||
body: { error: "Подождите", code: "too_many_requests" },
|
||||
passed: false,
|
||||
});
|
||||
assert.ok(call("10.0.0.2").passed);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user