mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 14:37:17 +03:00
use partialDeepEquals for getLockCategories
This commit is contained in:
@@ -3,6 +3,7 @@ import assert from "assert";
|
|||||||
import { client } from "../utils/httpClient";
|
import { client } from "../utils/httpClient";
|
||||||
import { insertLock } from "../utils/queryGen";
|
import { insertLock } from "../utils/queryGen";
|
||||||
import { multiGenRandomValue } from "../utils/getRandom";
|
import { multiGenRandomValue } from "../utils/getRandom";
|
||||||
|
import { partialDeepEquals } from "../utils/partialDeepEquals";
|
||||||
|
|
||||||
const endpoint = "/api/lockCategories";
|
const endpoint = "/api/lockCategories";
|
||||||
const defaultActionTypes = ["skip", "mute"];
|
const defaultActionTypes = ["skip", "mute"];
|
||||||
@@ -29,7 +30,7 @@ const validateResponse = (videoID: string, overrides: lockOverrides = {}, expect
|
|||||||
return getLockCategories(videoID, actionTypes, service)
|
return getLockCategories(videoID, actionTypes, service)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.deepStrictEqual(res.data, expectedResponse);
|
assert.ok(partialDeepEquals(res.data, expectedResponse));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -135,8 +136,8 @@ describe("getLockCategories", () => {
|
|||||||
return validateResponse(videoIDs[2], { actionTypes }, {
|
return validateResponse(videoIDs[2], { actionTypes }, {
|
||||||
categories: [
|
categories: [
|
||||||
"sponsor",
|
"sponsor",
|
||||||
|
"selfpromo",
|
||||||
// "nonmusic", // no nonmusic since it's on other service
|
// "nonmusic", // no nonmusic since it's on other service
|
||||||
"selfpromo"
|
|
||||||
],
|
],
|
||||||
reason: "3-longer-reason",
|
reason: "3-longer-reason",
|
||||||
actionTypes
|
actionTypes
|
||||||
|
|||||||
Reference in New Issue
Block a user