Skip to content

Commit af31f51

Browse files
committed
Add tests for fetch all
1 parent 0d9cce0 commit af31f51

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/cases/getBranding.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("getBranding", () => {
5555
await Promise.all([
5656
db.prepare("run", titleVotesQuery, ["UUID1", 3, 0, 0, 0, 0, 0]),
5757
db.prepare("run", titleVotesQuery, ["UUID2", 3, 0, 0, 0, 1, 0]),
58-
db.prepare("run", titleVotesQuery, ["UUID3", 1, 0, 0, 0, 0, 0]),
58+
db.prepare("run", titleVotesQuery, ["UUID3", 0, 0, 0, 0, 0, 0]),
5959
db.prepare("run", titleVotesQuery, ["UUID4", 5, 0, 0, 0, 0, 1]),
6060
db.prepare("run", thumbnailTimestampsQuery, ["UUID1T", 1]),
6161
db.prepare("run", thumbnailTimestampsQuery, ["UUID3T", 3]),
@@ -133,7 +133,7 @@ describe("getBranding", () => {
133133
});
134134

135135
it("should get top titles and thumbnails", async () => {
136-
await checkVideo(videoID1, videoID1Hash, {
136+
await checkVideo(videoID1, videoID1Hash, false, {
137137
titles: [{
138138
title: "title1",
139139
original: false,
@@ -149,7 +149,7 @@ describe("getBranding", () => {
149149
}, {
150150
title: "title3",
151151
original: true,
152-
votes: 1,
152+
votes: 0,
153153
locked: false,
154154
UUID: "UUID3" as BrandingUUID
155155
}],
@@ -175,7 +175,7 @@ describe("getBranding", () => {
175175
});
176176

177177
it("should get top titles and thumbnails prioritizing locks", async () => {
178-
await checkVideo(videoID2Locked, videoID2LockedHash, {
178+
await checkVideo(videoID2Locked, videoID2LockedHash, false, {
179179
titles: [{
180180
title: "title3",
181181
original: true,
@@ -217,7 +217,7 @@ describe("getBranding", () => {
217217
});
218218

219219
it("should get top titles and hide shadow hidden", async () => {
220-
await checkVideo(videoID2ShadowHide, videoID2ShadowHideHash, {
220+
await checkVideo(videoID2ShadowHide, videoID2ShadowHideHash, false, {
221221
titles: [{
222222
title: "title1",
223223
original: false,
@@ -271,7 +271,7 @@ describe("getBranding", () => {
271271
});
272272

273273
it("should get top titles and thumbnails that are unverified", async () => {
274-
await checkVideo(videoIDUnverified, videoIDUnverifiedHash, {
274+
await checkVideo(videoIDUnverified, videoIDUnverifiedHash, true, {
275275
titles: [{
276276
title: "title1",
277277
original: false,
@@ -312,12 +312,12 @@ describe("getBranding", () => {
312312
});
313313
});
314314

315-
async function checkVideo(videoID: string, videoIDHash: string, expected: {
315+
async function checkVideo(videoID: string, videoIDHash: string, fetchAll: boolean, expected: {
316316
titles: TitleResult[],
317317
thumbnails: ThumbnailResult[]
318318
}) {
319-
const result1 = await getBranding({ videoID, fetchAll: true });
320-
const result2 = await getBrandingByHash(videoIDHash, { fetchAll: true });
319+
const result1 = await getBranding({ videoID, fetchAll });
320+
const result2 = await getBrandingByHash(videoIDHash, { fetchAll });
321321

322322
assert.strictEqual(result1.status, 200);
323323
assert.strictEqual(result2.status, 200);

0 commit comments

Comments
 (0)