rev those debuggers up

This commit is contained in:
zkldi
2021-04-23 02:02:53 +01:00
parent b43213bc76
commit 059d37dd7f
5 changed files with 27 additions and 9 deletions
+10 -3
View File
@@ -4,20 +4,27 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to tap",
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"name": "Run Server",
"preLaunchTask": "npm: build",
"env": {
"NODE_ENV": "dev"
},
"program": "${workspaceFolder}/src/main.ts",
"outFiles": ["${workspaceFolder}/js/**/*.js"],
"outFiles": [
"${workspaceFolder}/js/**/*.js"
],
"skipFiles": [
"<node_internals>/**"
],
"outputCapture": "std"
}
},
]
}
@@ -11,6 +11,7 @@ import { GetUnsuccessfulScores } from "../../test-utils/score-import-utils";
t.test("POST /internal-api/import/file", async (t) => {
const cookie = await CreateFakeAuthCookie(mockApi);
t.beforeEach(ResetDBState);
RequireNeutralAuthentication("/internal-api/import/file", "POST");
@@ -24,10 +25,16 @@ t.test("POST /internal-api/import/file", async (t) => {
.field("importType", "csv:eamusement-iidx")
.field("playtype", "SP");
rootLogger.info("foo");
t.equal(res.body.success, true, "Should be successful.");
rootLogger.info("bar");
t.equal(GetUnsuccessfulScores(res.body.body), 0, "Should have 0 failed scores.");
rootLogger.info("baz");
t.end();
});
@@ -32,7 +32,6 @@ function ConvertFn(c: any): ScoreDocument | null {
userID: c.userID,
songID: c.songID,
playtype: c.scoreData.playtype,
difficulty: c.scoreData.difficulty,
chartID: c.chartID,
game: c.game,
timeAdded: c.timeAdded,
+5 -5
View File
@@ -3,7 +3,7 @@ import fetch from "node-fetch";
import { Command } from "commander";
import fs from "fs";
import path from "path";
import { config, Difficulties, ESDCore, IIDXBPIData } from "kamaitachi-common";
import { config, Difficulties, ESDCore, IIDXBPIData, ChartDocument } from "kamaitachi-common";
import { FindSongOnTitleVersion } from "../score-import/database-lookup/song-title";
import { FindChartWithPTDF } from "../score-import/database-lookup/chart-ptdf";
import db from "../db/db";
@@ -57,18 +57,18 @@ async function UpdatePoyashiData() {
const [playtype, diff] = res;
let ktchiSong = await FindSongOnTitleVersion("iidx", d.title, 28);
let ktchiSong = await FindSongOnTitleVersion("iidx", d.title, "28");
if (!ktchiSong) {
throw new Error(`Cannot find song ${d.title}?`);
}
let ktchiChart = await FindChartWithPTDF(
let ktchiChart = (await FindChartWithPTDF(
"iidx",
ktchiSong.id,
playtype as "SP" | "DP",
diff as Difficulties["iidx:DP" | "iidx:SP"]
);
)) as ChartDocument<"iidx:SP" | "iidx:DP">;
if (!ktchiChart) {
throw new Error(
@@ -80,7 +80,7 @@ async function UpdatePoyashiData() {
let kesd = ESDCore.CalculateESD(
config.judgementWindows.iidx.SP,
kavg / (ktchiChart.notedata.notecount * 2)
kavg / (ktchiChart.data.notecount * 2)
);
realData.push({
+5
View File
@@ -1,13 +1,18 @@
import supertest from "supertest";
import { rootLogger } from "../logger";
import server from "../server";
rootLogger.info("Creating Mock Server Connection...");
const connection = server.listen(8079);
rootLogger.info("Connecting to Supertest...");
const mockApi = supertest(connection);
export function CloseServerConnection() {
connection.close();
}
rootLogger.info("Done?");
export default mockApi;