From d671876d87ee4804e2e104daea6889cd4025fe26 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 6 Jun 2022 21:50:14 +0100 Subject: [PATCH] test: add regression tests for jubeat percents --- .../common/batch-manual/converter.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts index 3e1c49ad1..fcee873ff 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts @@ -601,6 +601,29 @@ t.test("#ConverterFn", (t) => { t.end(); }); + t.test( + "Should throw if the percent parameter is too small for jubeat when the score is reasonably high", + (t) => { + t.rejects( + () => + ConverterBatchManual( + deepmerge(baseJubeatScore, { percent: 0.1, score: 100_000 } as Partial< + BatchManualScore<"jubeat:Single"> + >), + { game: "jubeat", service: "foo", playtype: "Single", version: null }, + importType, + logger + ), + { + message: + "The percent you passed for this jubeat score was less than 1, but the score was above 100k. This is not possible. Have you sent percent as a number between 0 and 1?", + } + ); + + t.end(); + } + ); + t.test( "Should throw if the percent parameter is over 100 but the chart is not hard mode (for jubeat)", (t) => {