mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-08 22:59:52 +03:00
remove broken types
This commit is contained in:
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
declare module "tap" {
|
||||
export function rejects(
|
||||
promiseOrFn: Promise<any> | ((...args: any[]) => Promise<any>),
|
||||
expectedError: any,
|
||||
message?: string,
|
||||
extra?: any
|
||||
): Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import t from "tap";
|
||||
import { CloseAllConnections } from "../../../../../test-utils/close-connections";
|
||||
import ResetDBState from "../../../../../test-utils/reset-db-state";
|
||||
import { GetKTDataJSON } from "../../../../../test-utils/test-data";
|
||||
import CreateLogCtx from "../../../../logger/logger";
|
||||
import { ConvertAPIArcDDR } from "./converter";
|
||||
import { ARCDDRScore } from "./types";
|
||||
import deepmerge from "deepmerge";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
const arcScore = GetKTDataJSON("./api-arc/ddr-score.json") as ARCDDRScore;
|
||||
|
||||
t.test("#ConvertAPIArcDDR", (t) => {
|
||||
t.beforeEach(ResetDBState);
|
||||
|
||||
t.test("Should convert a valid score", async (t) => {
|
||||
const res = await ConvertAPIArcDDR(arcScore, {}, "api/arc-ddr", logger);
|
||||
|
||||
t.strictSame(res, {
|
||||
song: {},
|
||||
chart: {},
|
||||
dryScore: {},
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("Should throw on an invalid score", (t) => {
|
||||
t.rejects(
|
||||
() =>
|
||||
ConvertAPIArcDDR(
|
||||
deepmerge(arcScore, { ex_score: "foo" }),
|
||||
{},
|
||||
"api/arc-ddr",
|
||||
logger
|
||||
),
|
||||
{
|
||||
message: /Invalid ARC Score:/iu,
|
||||
} as any
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("Should throw on no chart", (t) => {
|
||||
t.rejects(
|
||||
() =>
|
||||
ConvertAPIArcDDR(
|
||||
deepmerge(arcScore, { chart_id: "foo" }),
|
||||
{},
|
||||
"api/arc-ddr",
|
||||
logger
|
||||
),
|
||||
{
|
||||
message: /Could not find chart/iu,
|
||||
} as any
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.teardown(CloseAllConnections);
|
||||
Reference in New Issue
Block a user