mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-13 23:17:02 +03:00
Update test cases with new automod api
This commit is contained in:
@@ -120,7 +120,7 @@ describe('postSkipSegments', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should be rejected if there's not at least 65% overlap with NB", (done) => {
|
it("Should be rejected if NB's predicted probability is <70%.", (done) => {
|
||||||
request.get(utils.getbaseURL()
|
request.get(utils.getbaseURL()
|
||||||
+ "/api/postVideoSponsorTimes?videoID=LevkAjUE6d4&startTime=40&endTime=60&userID=testing", null,
|
+ "/api/postVideoSponsorTimes?videoID=LevkAjUE6d4&startTime=40&endTime=60&userID=testing", null,
|
||||||
(err, res, body) => {
|
(err, res, body) => {
|
||||||
@@ -130,26 +130,6 @@ describe('postSkipSegments', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should be accepted if only off by 7s", (done) => {
|
|
||||||
request.get(utils.getbaseURL()
|
|
||||||
+ "/api/postVideoSponsorTimes?videoID=LevkAjUE6d4&startTime=0&endTime=14.079&userID=testing", null,
|
|
||||||
(err, res, body) => {
|
|
||||||
if (err) done("Couldn't call endpoint");
|
|
||||||
else if (res.statusCode === 200) done(); // pass
|
|
||||||
else done("non 403 status code: " + res.statusCode + " ("+body+")");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Should be accepted if there's at least 65% overlap with NB" , (done) => {
|
|
||||||
request.get(utils.getbaseURL()
|
|
||||||
+ "/api/postVideoSponsorTimes?videoID=LevkAjUE6d4&startTime=0&endTime=6&userID=testing", null,
|
|
||||||
(err, res, body) => {
|
|
||||||
if (err) done("Couldn't call endpoint");
|
|
||||||
else if (res.statusCode === 200) done(); // pass
|
|
||||||
else done("non 200 status code: " + res.statusCode + " ("+body+")");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should be allowed if youtube thinks duration is 0', (done) => {
|
it('Should be allowed if youtube thinks duration is 0', (done) => {
|
||||||
request.get(utils.getbaseURL()
|
request.get(utils.getbaseURL()
|
||||||
+ "/api/postVideoSponsorTimes?videoID=noDuration&startTime=30&endTime=10000&userID=testing", null,
|
+ "/api/postVideoSponsorTimes?videoID=noDuration&startTime=30&endTime=10000&userID=testing", null,
|
||||||
|
|||||||
@@ -15,6 +15,17 @@ app.post('/CompletelyIncorrectReportWebhook', (req, res) => {
|
|||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/NeuralBlock/api/checkSponsorSegments', (req, res) => {
|
||||||
|
if (req.query.vid === "LevkAjUE6d4") {
|
||||||
|
res.json({
|
||||||
|
probabilities: [0.69]
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.sendStatus(500);
|
||||||
|
});
|
||||||
|
|
||||||
|
//getSponsorSegments is no longer being used for automod
|
||||||
app.get('/NeuralBlock/api/getSponsorSegments', (req, res) => {
|
app.get('/NeuralBlock/api/getSponsorSegments', (req, res) => {
|
||||||
if (req.query.vid === "LevkAjUE6d4") {
|
if (req.query.vid === "LevkAjUE6d4") {
|
||||||
res.json({
|
res.json({
|
||||||
@@ -22,7 +33,6 @@ app.get('/NeuralBlock/api/getSponsorSegments', (req, res) => {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.sendStatus(500);
|
res.sendStatus(500);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user