mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-13 02:14:32 +01:00
7364499f11
- highLoad - compact getUserID - add genRandomValue method
30 lines
913 B
TypeScript
30 lines
913 B
TypeScript
import sinon from "sinon";
|
|
import { db } from "../../src/databases/databases";
|
|
import assert from "assert";
|
|
import { client } from "../utils/httpClient";
|
|
client.defaults.validateStatus = (status) => status < 600;
|
|
|
|
describe("High load test", () => {
|
|
before(() => {
|
|
sinon.stub(db, "highLoad").returns(true);
|
|
});
|
|
|
|
after(() => {
|
|
sinon.restore();
|
|
});
|
|
|
|
it("Should return 503 on getTopUsers", () =>
|
|
client.get("/api/getTopUsers?sortType=0")
|
|
.then(res => assert.strictEqual(res.status, 503))
|
|
);
|
|
|
|
it("Should return 503 on getTopCategoryUsers", () =>
|
|
client.get("/api/getTopCategoryUsers?sortType=0&category=sponsor")
|
|
.then(res => assert.strictEqual(res.status, 503))
|
|
);
|
|
|
|
it("Should return 0 on getTotalStats", () =>
|
|
client.get("/api/getTotalStats")
|
|
.then(res => assert.strictEqual(res.status, 200))
|
|
);
|
|
});
|