Limit mute action type to specific categories

This commit is contained in:
Ajay Ramachandran
2021-09-04 00:33:37 -04:00
parent 6f29b807c5
commit 1823a91d54
3 changed files with 41 additions and 2 deletions

View File

@@ -137,6 +137,31 @@ describe("postSkipSegments", () => {
.catch(err => done(err));
});
it("Should not be able to submit an intro with mute action type (JSON method)", (done: Done) => {
fetch(`${getbaseURL()}/api/postVideoSponsorTimes`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
userID: "testtesttesttesttesttesttesttesttest",
videoID: "dQw4w9WgXpQ",
segments: [{
segment: [0, 10],
category: "intro",
actionType: "mute"
}],
}),
})
.then(async res => {
assert.strictEqual(res.status, 400);
const row = await db.prepare("get", `SELECT "startTime", "endTime", "locked", "category", "actionType" FROM "sponsorTimes" WHERE "videoID" = ?`, ["dQw4w9WgXpQ"]);
assert.strictEqual(row, undefined);
done();
})
.catch(err => done(err));
});
it("Should be able to submit a single time with a duration from the YouTube API (JSON method)", (done: Done) => {
fetch(`${getbaseURL()}/api/postVideoSponsorTimes`, {
method: "POST",