Store video info from submissions

This commit is contained in:
Ajay Ramachandran
2021-10-17 14:42:48 -04:00
parent bda2ff4d23
commit 450f4a2d44
4 changed files with 32 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ describe("postSkipSegments", () => {
const queryDatabase = (videoID: string) => db.prepare("get", `SELECT "startTime", "endTime", "locked", "category" FROM "sponsorTimes" WHERE "videoID" = ?`, [videoID]);
const queryDatabaseActionType = (videoID: string) => db.prepare("get", `SELECT "startTime", "endTime", "locked", "category", "actionType" FROM "sponsorTimes" WHERE "videoID" = ?`, [videoID]);
const queryDatabaseDuration = (videoID: string) => db.prepare("get", `SELECT "startTime", "endTime", "locked", "category", "videoDuration" FROM "sponsorTimes" WHERE "videoID" = ?`, [videoID]);
const queryDatabaseVideoInfo = (videoID: string) => db.prepare("get", `SELECT * FROM "videoInfo" WHERE "videoID" = ?`, [videoID]);
const endpoint = "/api/skipSegments";
const postSkipSegmentJSON = (data: Record<string, any>) => client({
@@ -107,6 +108,17 @@ describe("postSkipSegments", () => {
category: "sponsor",
};
assert.ok(partialDeepEquals(row, expected));
const videoInfo = await queryDatabaseVideoInfo(videoID);
const expectedVideoInfo = {
videoID,
title: "Example Title",
channelID: "ExampleChannel",
published: 123,
genreUrl: ""
};
assert.ok(partialDeepEquals(videoInfo, expectedVideoInfo));
done();
})
.catch(err => done(err));