debugging donotrun

This commit is contained in:
zkldi
2021-04-20 16:30:00 +01:00
parent edd7aeb73a
commit 760952bcf2
4 changed files with 19 additions and 9 deletions
@@ -100,6 +100,8 @@ export async function ImportIterableDatapoint<D, C>(
) {
const converterReturns = await ConverterFunction(data, context, logger);
logger.debug("Converter Function Finished");
if (Array.isArray(converterReturns)) {
return Promise.all(
converterReturns.map((e) => ImportFromConverterReturn(userID, e, logger))
@@ -115,7 +117,6 @@ export async function ImportIterableDatapoint<D, C>(
* @param dryScore - The score that is to be hydrated and inserted.
* @param chart - The chart this score is on.
* @param song - The song this score is on.
* @returns no idea yet
*/
async function HydrateAndInsertScore(
userID: integer,
+9 -3
View File
@@ -1,11 +1,13 @@
import tap from "tap";
import t from "tap";
import { rootLogger } from "../logger";
import { CloseAllConnections } from "./close-connections";
import mockApi from "./mock-api";
type TestCB = Exclude<Parameters<typeof tap.test>[1], undefined>;
type TestCB = Exclude<Parameters<typeof t.test>[1], undefined>;
type Test = Parameters<TestCB>[0];
export function RequireNeutralAuthentication(t: Test, url: string, method: "GET" | "POST" = "GET") {
export function RequireNeutralAuthentication(url: string, method: "GET" | "POST" = "GET") {
t.test(`Testing authentication for ${method} ${url}.`, async (t) => {
let res;
@@ -21,5 +23,9 @@ export function RequireNeutralAuthentication(t: Test, url: string, method: "GET"
"You are not authorised to perform this action.",
"Should return an appropriate error message."
);
// CloseAllConnections();
t.end();
});
}
+7 -4
View File
@@ -1,13 +1,13 @@
import mockApi from "./mock-api";
import assert from "assert";
import db from "../db/db";
import ResetDBState from "./reset-db-state";
import CreateLogCtx from "../logger";
import supertest from "supertest";
const logger = CreateLogCtx("fake-session.ts");
export async function CreateFakeAuthCookie() {
export async function CreateFakeAuthCookie(mockApi: supertest.SuperTest<supertest.Test>) {
logger.info("1");
await ResetDBState();
logger.info("2");
// possible security issue, ask hazel
let res = await mockApi.post("/internal-api/auth/login").send({
username: "test_zkldi",
@@ -15,10 +15,13 @@ export async function CreateFakeAuthCookie() {
captcha: "asdf",
});
logger.info("3");
if (res.status !== 200) {
logger.crit("Failed to login. Cannot generate auth cookie.");
throw res.body;
}
logger.info("4");
return res.headers["set-cookie"] as string[];
}
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* Resets the state of the database.
*/
import db from "../db/db";
import db, { CloseMongoConnection, ReopenMongoConnection } from "../db/db";
import fs from "fs";
import path from "path";
import CreateLogCtx from "../logger";