This commit is contained in:
Michael C
2021-09-17 00:01:29 -04:00
parent 9e9fcd47c0
commit 802dd50163

View File

@@ -4,14 +4,17 @@ import {db} from "../../src/databases/databases";
import {getHash} from "../../src/utils/getHash";
import assert from "assert";
describe("getIsUserVIP", () => {
const endpoint = `${getbaseURL()}/api/isUserVIP`;
const VIPUser = "isUserVIPVIP";
const normalUser = "isUserVIPNormal";
describe("getIsUserVIP", () => {
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();