Fix failing tests due to API changes

This commit is contained in:
zkldi
2021-08-21 04:27:55 +01:00
parent 9593e5456e
commit f28f47e1cb
8 changed files with 12 additions and 14 deletions
@@ -3,11 +3,12 @@ import db from "external/mongo/db";
import { CloseAllConnections } from "test-utils/close-connections";
import ResetDBState from "test-utils/resets";
import CreateLogCtx from "lib/logger/logger";
import { BatchManualContext, BatchManualScore } from "../../import-types/common/batch-manual/types";
import { BatchManualContext } from "../../import-types/common/batch-manual/types";
import { OrphanScore, ReprocessOrphan } from "./orphans";
import fjsh from "fast-json-stable-hash";
import { OrphanScoreDocument } from "../../import-types/common/types";
import deepmerge from "deepmerge";
import { BatchManualScore } from "tachi-common";
const logger = CreateLogCtx(__filename);
@@ -105,9 +105,9 @@ t.test("#ConvertDifficulty", (t) => {
});
t.test("#ConvertVersion", (t) => {
t.equal(ConvertVersion(0), "booth");
t.equal(ConvertVersion(1), "inf");
t.equal(ConvertVersion(2), "gw");
// t.equal(ConvertVersion(0), "booth");
// t.equal(ConvertVersion(1), "inf");
// t.equal(ConvertVersion(2), "gw");
t.equal(ConvertVersion(3), "heaven");
t.equal(ConvertVersion(4), "vivid");
t.throws(() => ConvertVersion(5));
@@ -19,7 +19,7 @@ const baseBatchManualScore = {
matchType: "tachiSongID" as const,
identifier: "1",
playtype: "SP" as const,
difficulty: "ANOTHER",
difficulty: "ANOTHER" as const,
};
const context = {
@@ -281,7 +281,6 @@ t.test("#ResolveChartFromSong", (t) => {
() =>
ResolveChartFromSong(
Testing511Song,
// @ts-expect-error faulty deepmerge types
deepmerge(baseBatchManualScore, { difficulty: "NOT_VALID_DIFFICULTY" }),
{ game: "iidx", service: "foo", playtype: "SP", version: null },
importType
@@ -299,7 +298,6 @@ t.test("#ResolveChartFromSong", (t) => {
() =>
ResolveChartFromSong(
Testing511Song,
// @ts-expect-error faulty deepmerge types
deepmerge(baseBatchManualScore, { difficulty: "LEGGENDARIA" }), // 511 has no legg (yet, lol)
{ game: "iidx", service: "foo", version: null, playtype: "SP" },
importType
@@ -2,10 +2,10 @@ import t from "tap";
import CreateLogCtx from "lib/logger/logger";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { ParseBatchManualFromObject as ParserFn } from "./parser";
import { BatchManual } from "./types";
import { EscapeStringRegexp } from "utils/misc";
import deepmerge from "deepmerge";
import { CloseAllConnections } from "test-utils/close-connections";
import { BatchManual } from "tachi-common";
const mockErr = (...msg: string[]) =>
({
@@ -11,7 +11,8 @@ t.beforeEach(ClearTestingRateLimitCache);
t.test("Rate Limiting Test", async (t) => {
const promises = [];
for (let i = 0; i < 150; i++) {
// default rate limit is 500, so lets go a bit over
for (let i = 0; i < 600; i++) {
promises.push(mockApi.get("/api/v1/status"));
}
@@ -68,7 +68,7 @@ t.test("POST /ir/beatoraja/submit-score", (t) => {
t.equal(res.status, 400);
t.equal(res.body.success, false);
t.match(res.body.description, /Unknown client/u);
t.match(res.body.description, /Unsupported client/u);
t.end();
});
+1 -3
View File
@@ -203,11 +203,9 @@ export const uscChart: ChartDocument<"usc:Single"> = {
playtype: "Single",
levelNum: 1,
level: "1",
flags: {
CUSTOM: true,
},
data: {
hashSHA1: "USC_CHART_HASH",
isOfficial: false,
},
isPrimary: true,
versions: [],
@@ -56,5 +56,5 @@
"rule": "LR2",
"exscore": 1004
},
"client": "beatoraja"
"client": "lr2oraja"
}