mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-19 14:09:06 +03:00
naming
This commit is contained in:
@@ -4,14 +4,17 @@ import {db} from "../../src/databases/databases";
|
||||
import {getHash} from "../../src/utils/getHash";
|
||||
import assert from "assert";
|
||||
|
||||
const endpoint = `${getbaseURL()}/api/isUserVIP`;
|
||||
const VIPUser = "isUserVIPVIP";
|
||||
const normalUser = "isUserVIPNormal";
|
||||
|
||||
describe("getIsUserVIP", () => {
|
||||
const endpoint = `${getbaseURL()}/api/isUserVIP`;
|
||||
before(() => {
|
||||
db.prepare("run", 'INSERT INTO "vipUsers" ("userID") VALUES (?)', [getHash("isUserVIPVIP")]);
|
||||
db.prepare("run", 'INSERT INTO "vipUsers" ("userID") VALUES (?)', [getHash(VIPUser)]);
|
||||
});
|
||||
|
||||
it("Should be able to get a 200", (done: Done) => {
|
||||
fetch(`${endpoint}?userID=isUserVIPVIP`)
|
||||
fetch(`${endpoint}?userID=${VIPUser}`)
|
||||
.then(res => {
|
||||
assert.strictEqual(res.status, 200, "response should be 200");
|
||||
done();
|
||||
@@ -30,7 +33,7 @@ describe("getIsUserVIP", () => {
|
||||
});
|
||||
|
||||
it("Should say a VIP is a VIP", (done: Done) => {
|
||||
fetch(`${endpoint}?userID=isUserVIPVIP`)
|
||||
fetch(`${endpoint}?userID=${VIPUser}`)
|
||||
.then(async res => {
|
||||
assert.strictEqual(res.status, 200);
|
||||
const data = await res.json();
|
||||
@@ -41,7 +44,7 @@ describe("getIsUserVIP", () => {
|
||||
});
|
||||
|
||||
it("Should say a normal user is not a VIP", (done: Done) => {
|
||||
fetch(`${endpoint}?userID=isUserVIPNormal`)
|
||||
fetch(`${endpoint}?userID=${normalUser}`)
|
||||
.then(async res => {
|
||||
assert.strictEqual(res.status, 200);
|
||||
const data = await res.json();
|
||||
|
||||
Reference in New Issue
Block a user