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 {getHash} from "../../src/utils/getHash";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
|
|
||||||
|
const endpoint = `${getbaseURL()}/api/isUserVIP`;
|
||||||
|
const VIPUser = "isUserVIPVIP";
|
||||||
|
const normalUser = "isUserVIPNormal";
|
||||||
|
|
||||||
describe("getIsUserVIP", () => {
|
describe("getIsUserVIP", () => {
|
||||||
const endpoint = `${getbaseURL()}/api/isUserVIP`;
|
|
||||||
before(() => {
|
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) => {
|
it("Should be able to get a 200", (done: Done) => {
|
||||||
fetch(`${endpoint}?userID=isUserVIPVIP`)
|
fetch(`${endpoint}?userID=${VIPUser}`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
assert.strictEqual(res.status, 200, "response should be 200");
|
assert.strictEqual(res.status, 200, "response should be 200");
|
||||||
done();
|
done();
|
||||||
@@ -30,7 +33,7 @@ describe("getIsUserVIP", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should say a VIP is a VIP", (done: Done) => {
|
it("Should say a VIP is a VIP", (done: Done) => {
|
||||||
fetch(`${endpoint}?userID=isUserVIPVIP`)
|
fetch(`${endpoint}?userID=${VIPUser}`)
|
||||||
.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();
|
||||||
@@ -41,7 +44,7 @@ describe("getIsUserVIP", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should say a normal user is not a VIP", (done: Done) => {
|
it("Should say a normal user is not a VIP", (done: Done) => {
|
||||||
fetch(`${endpoint}?userID=isUserVIPNormal`)
|
fetch(`${endpoint}?userID=${normalUser}`)
|
||||||
.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();
|
||||||
|
|||||||
Reference in New Issue
Block a user