Skip to content

Commit dd7656d

Browse files
committed
add lockCategories tests, getUserInfo
1 parent f683ed4 commit dd7656d

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

test/cases/getUserInfo.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,15 @@ describe("getUserInfo", () => {
263263
.catch(err => done(err));
264264
});
265265

266+
it("Should throw 400 with invalid array", (done) => {
267+
client.get(endpoint, { params: { userID: "x", values: 123 } })
268+
.then(res => {
269+
assert.strictEqual(res.status, 400);
270+
done(); // pass
271+
})
272+
.catch(err => done(err));
273+
});
274+
266275
it("Should return 200 on userID not found", (done) => {
267276
client.get(endpoint, { params: { userID: "notused-userid" } })
268277
.then(res => {
@@ -307,4 +316,29 @@ describe("getUserInfo", () => {
307316
})
308317
.catch(err => done(err));
309318
});
319+
320+
it("Should be able to get permissions", (done) => {
321+
client.get(endpoint, { params: { userID: "getuserinfo_user_01", value: "permissions" } })
322+
.then(res => {
323+
assert.strictEqual(res.status, 200);
324+
const expected = {
325+
permissions: {
326+
sponsor: true,
327+
selfpromo: true,
328+
exclusive_access: true,
329+
interaction: true,
330+
intro: true,
331+
outro: true,
332+
preview: true,
333+
music_offtopic: true,
334+
filler: true,
335+
poi_highlight: true,
336+
chapter: false,
337+
},
338+
};
339+
assert.ok(partialDeepEquals(res.data, expected));
340+
done(); // pass
341+
})
342+
.catch(err => done(err));
343+
});
310344
});

test/cases/lockCategoriesRecords.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,4 +560,43 @@ describe("lockCategoriesRecords", () => {
560560
})
561561
.catch(err => done(err));
562562
});
563+
564+
it("should be able to add poi type category by type skip", (done) => {
565+
const videoID = "add-record-poi";
566+
client.post(endpoint, {
567+
videoID,
568+
userID: lockVIPUser,
569+
categories: ["poi_highlight"],
570+
actionTypes: ["skip"]
571+
})
572+
.then(res => {
573+
assert.strictEqual(res.status, 200);
574+
checkLockCategories(videoID)
575+
.then(result => {
576+
assert.strictEqual(result.length, 1);
577+
assert.strictEqual(result[0], "poi_highlight");
578+
});
579+
done();
580+
})
581+
.catch(err => done(err));
582+
});
583+
584+
it("Should not add lock of invalid type", (done) => {
585+
const videoID = "add_invalid_type";
586+
client.post(endpoint, {
587+
videoID,
588+
userID: lockVIPUser,
589+
categories: ["future_unused_invalid_type"],
590+
actionTypes: ["skip"]
591+
})
592+
.then(res => {
593+
assert.strictEqual(res.status, 200);
594+
checkLockCategories(videoID)
595+
.then(result => {
596+
assert.strictEqual(result.length, 0);
597+
});
598+
done();
599+
})
600+
.catch(err => done(err));
601+
});
563602
});

0 commit comments

Comments
 (0)