mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 09:07:47 +01:00
32 lines
890 B
TypeScript
32 lines
890 B
TypeScript
import assert from "assert";
|
|
import { postSkipSegmentParam } from "./postSkipSegments";
|
|
import { config } from "../../src/config";
|
|
import sinon from "sinon";
|
|
|
|
const videoID = "postSkipSegments-404-video";
|
|
|
|
describe("postSkipSegments 400 - stubbed config", () => {
|
|
const USERID_LIMIT = 30;
|
|
before(() => {
|
|
sinon.stub(config, "minUserIDLength").value(USERID_LIMIT);
|
|
});
|
|
after(() => {
|
|
sinon.restore();
|
|
});
|
|
|
|
it("Should return 400 if userID is too short", (done) => {
|
|
const userID = "a".repeat(USERID_LIMIT - 10);
|
|
postSkipSegmentParam({
|
|
videoID,
|
|
startTime: 1,
|
|
endTime: 5,
|
|
category: "sponsor",
|
|
userID
|
|
})
|
|
.then(res => {
|
|
assert.strictEqual(res.status, 400);
|
|
done();
|
|
})
|
|
.catch(err => done(err));
|
|
});
|
|
});
|