From 99d886c4cad0b2c186d4e346629f7b79bf6e2d85 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Tue, 9 Apr 2024 22:11:11 +0100 Subject: [PATCH] test: add test for that stuff --- .../score-importing/validate-score.test.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 server/src/lib/score-import/framework/score-importing/validate-score.test.ts diff --git a/server/src/lib/score-import/framework/score-importing/validate-score.test.ts b/server/src/lib/score-import/framework/score-importing/validate-score.test.ts new file mode 100644 index 000000000..c74fd96c0 --- /dev/null +++ b/server/src/lib/score-import/framework/score-importing/validate-score.test.ts @@ -0,0 +1,24 @@ +import { ValidateScore } from "./validate-score"; +import { ONE_DAY } from "lib/constants/time"; +import t from "tap"; +import { Testing511SPA, TestingIIDXSPScore } from "test-utils/test-data"; + +t.test("#ValidateScore", (t) => { + t.test("Should reject scores in the future", (t) => { + t.throws( + () => { + ValidateScore( + { ...TestingIIDXSPScore, timeAchieved: Date.now() + ONE_DAY * 2 }, + Testing511SPA + ); + }, + { + message: "Invalid timestamp: score happens in the future.", + } + ); + + t.end(); + }); + + t.end(); +});