mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-19 14:09:06 +03:00
new stringDeepEquals
This commit is contained in:
@@ -5,6 +5,14 @@ import {db} from "../../src/databases/databases";
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import {LockCategory} from "../../src/types/segments.model";
|
import {LockCategory} from "../../src/types/segments.model";
|
||||||
|
|
||||||
|
const stringDeepEquals = (a: string[] ,b: string[]): boolean => {
|
||||||
|
let result = true;
|
||||||
|
b.forEach((e) => {
|
||||||
|
if (!a.includes(e)) result = false;
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
describe("lockCategoriesRecords", () => {
|
describe("lockCategoriesRecords", () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
const insertVipUserQuery = 'INSERT INTO "vipUsers" ("userID") VALUES (?)';
|
const insertVipUserQuery = 'INSERT INTO "vipUsers" ("userID") VALUES (?)';
|
||||||
@@ -565,7 +573,7 @@ describe("lockCategoriesRecords", () => {
|
|||||||
.then(async res => {
|
.then(async res => {
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
assert.deepStrictEqual(data.categories, expected.categories);
|
assert.ok(stringDeepEquals(data.categories, expected.categories));
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
.catch(err => done(err));
|
.catch(err => done(err));
|
||||||
|
|||||||
Reference in New Issue
Block a user