Add tests for the new batch manual behaviour.

This commit is contained in:
zkldi
2021-12-02 10:20:26 +00:00
parent c7fd667d70
commit ab22caad16
2 changed files with 58 additions and 0 deletions
@@ -358,6 +358,38 @@ t.test("#ConverterFn", (t) => {
t.end();
});
t.test("Should produce a with timeAchieved null if timeAchieved is 0", async (t) => {
const res = await ConverterBatchManual(
deepmerge(baseBatchManualScore, { timeAchieved: 0 }),
{ game: "iidx", service: "foo", playtype: "SP", version: null },
importType,
logger
);
t.hasStrict(res, {
chart: Testing511SPA,
song: { id: 1 },
dryScore: {
game: "iidx",
service: "foo (BATCH-MANUAL)",
comment: null,
importType: "file/batch-manual",
timeAchieved: null,
scoreData: {
lamp: "HARD CLEAR",
score: 500,
grade: "E",
// percent: 31.5, -- ish, FPA is hard.
judgements: {},
hitMeta: {},
},
scoreMeta: {},
},
});
t.end();
});
t.test("Should reject a score with > 100%", (t) => {
t.rejects(
() =>
@@ -402,6 +402,32 @@ t.test("#ParserFn", (t) => {
t.end();
});
t.test("TimeAchieved of 0 should be legal.", (t) => {
const res = ParserFn(dm({ timeAchieved: 0 }), "file/batch-manual", logger);
t.hasStrict(res, {
game: "iidx",
context: {
service: "foo",
game: "iidx",
playtype: "SP",
version: null,
},
iterable: [
{
score: 1000,
lamp: "HARD CLEAR",
matchType: "tachiSongID",
identifier: "123",
difficulty: "ANOTHER",
timeAchieved: 0,
},
],
});
t.end();
});
t.test("Invalid Identifier", (t) => {
// this is not a valid playtype for IIDX
const fn = () => ParserFn(dm({ identifier: null }), "file/batch-manual", logger);