mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 20:17:02 +03:00
add lockCategories tests, getUserInfo
This commit is contained in:
@@ -263,6 +263,15 @@ describe("getUserInfo", () => {
|
|||||||
.catch(err => done(err));
|
.catch(err => done(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should throw 400 with invalid array", (done) => {
|
||||||
|
client.get(endpoint, { params: { userID: "x", values: 123 } })
|
||||||
|
.then(res => {
|
||||||
|
assert.strictEqual(res.status, 400);
|
||||||
|
done(); // pass
|
||||||
|
})
|
||||||
|
.catch(err => done(err));
|
||||||
|
});
|
||||||
|
|
||||||
it("Should return 200 on userID not found", (done) => {
|
it("Should return 200 on userID not found", (done) => {
|
||||||
client.get(endpoint, { params: { userID: "notused-userid" } })
|
client.get(endpoint, { params: { userID: "notused-userid" } })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -307,4 +316,29 @@ describe("getUserInfo", () => {
|
|||||||
})
|
})
|
||||||
.catch(err => done(err));
|
.catch(err => done(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should be able to get permissions", (done) => {
|
||||||
|
client.get(endpoint, { params: { userID: "getuserinfo_user_01", value: "permissions" } })
|
||||||
|
.then(res => {
|
||||||
|
assert.strictEqual(res.status, 200);
|
||||||
|
const expected = {
|
||||||
|
permissions: {
|
||||||
|
sponsor: true,
|
||||||
|
selfpromo: true,
|
||||||
|
exclusive_access: true,
|
||||||
|
interaction: true,
|
||||||
|
intro: true,
|
||||||
|
outro: true,
|
||||||
|
preview: true,
|
||||||
|
music_offtopic: true,
|
||||||
|
filler: true,
|
||||||
|
poi_highlight: true,
|
||||||
|
chapter: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
assert.ok(partialDeepEquals(res.data, expected));
|
||||||
|
done(); // pass
|
||||||
|
})
|
||||||
|
.catch(err => done(err));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -560,4 +560,43 @@ describe("lockCategoriesRecords", () => {
|
|||||||
})
|
})
|
||||||
.catch(err => done(err));
|
.catch(err => done(err));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should be able to add poi type category by type skip", (done) => {
|
||||||
|
const videoID = "add-record-poi";
|
||||||
|
client.post(endpoint, {
|
||||||
|
videoID,
|
||||||
|
userID: lockVIPUser,
|
||||||
|
categories: ["poi_highlight"],
|
||||||
|
actionTypes: ["skip"]
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
assert.strictEqual(res.status, 200);
|
||||||
|
checkLockCategories(videoID)
|
||||||
|
.then(result => {
|
||||||
|
assert.strictEqual(result.length, 1);
|
||||||
|
assert.strictEqual(result[0], "poi_highlight");
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(err => done(err));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should not add lock of invalid type", (done) => {
|
||||||
|
const videoID = "add_invalid_type";
|
||||||
|
client.post(endpoint, {
|
||||||
|
videoID,
|
||||||
|
userID: lockVIPUser,
|
||||||
|
categories: ["future_unused_invalid_type"],
|
||||||
|
actionTypes: ["skip"]
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
assert.strictEqual(res.status, 200);
|
||||||
|
checkLockCategories(videoID)
|
||||||
|
.then(result => {
|
||||||
|
assert.strictEqual(result.length, 0);
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(err => done(err));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user